Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2D View Problem

Author
Message
Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 14th Sep 2010 20:05
Although I haven't thoroughly checked the forums, I'd figure I'll get this out here now. I'm working on a 2D game along the same vein as Castlevania, but I'm stuck with views.

Now, my map idea is not about placing tiles, so there's no grid to test against for the objects (player and enemies). Instead, the game will paste images previously made in Paint at specific points, and check the coloring to see if it's solid or whatever. Now, the maps may extend past the sizes of the screen, and some objects may also be out of view. My problem is that the program won't check the map in its entirety for every object, which means that off-screen objects that should be falling stay in midair until they're visible, after which they fall.

Any ideas would be greatly appreciated.
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Sep 2010 11:41
Do each object have properties like a falling switch or falling speed that when not falling would be set to zero? If they do it shouldn't be too hard to check for only those objects still in a "falling state" and continue making the object fall while being seen or not.

Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 15th Sep 2010 15:38
Yep, I have most of that set up. I think the issue is that the parts of the map not seen on the screen get replaced with black pixels by the program, which are solid points.

The pic I'm including hopefully better describes my problem. The yellow box shows what the player sees, and the map would be the size of the whole pic.

I think what I'm asking is...is there a way to have the whole map drawn at once?

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Sep 2010 08:21
Quote: "I think what I'm asking is...is there a way to have the whole map drawn at once?"


I don't see why it couldn't be drawn all at once if you can control how it's drawn to the screen. What programming language are you using?

Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 16th Sep 2010 14:02
I'm using Dark Basic Professional.
Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 19th Sep 2010 15:01
You mentioned controlling how the map gets drawn to the screen, which gave me the idea to try using the bitmap commands. After a little modification (like 3 lines), I believe I've gotten it to work. So that should do it for my problem for now, I'll ask if something else comes up.

Thanks for the assistance, I really appreciate it.
Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 19th Sep 2010 19:19
...I've got another issue, sure enough. I tried using bitmaps to solve the previous problem, but it only works for objects on the right side of the viewing area.

I'm assuming that making a bitmap essentially makes a virtual screen to draw to, with the upper-left of the window always being point 0, 0. If that's the case, anything that would be to the left of your view would be counted as black pixels (which is a solid point to the program).

So, is there a way to shift the bitmap itself?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 08:58
You could create a bitmap much bigger than the actual screen size but still only copy parts of the bitmap to the main view screen. You don't need to shift the bitmap itself but the area you want to copy.

Cheezguy
14
Years of Service
User Offline
Joined: 30th Sep 2009
Location:
Posted: 20th Sep 2010 12:13
I thought about it before going to bed, and realized there's a simple solution. Basically, my code was set up to take the view into account on the bitmap even though it's all pasted. So the pieces were being shifted for no reason, which was messing everything up. I changed that around, and what I have seems to be working.

I really hope that's all I need for now, and thanks again for assisting me. =)
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 23:03
Np. Glad you got it working.

Login to post a reply

Server time is: 2024-03-28 12:08:30
Your offset time is: 2024-03-28 12:08:30