Sign in to follow this  

2d level navigation using dark gdk

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone i have started creating my own game so i can get ahead in my studies and i have come up a few questions as to the navigation of the game Its a 2d side scrolling game similiar to mario or megaman etc I am using Visual C++ with DarkGDK I have a good knowledge of C++ and basic understanding of tilesets and i havent had any problems with moving or scrolling the character and landscape My question is about the collisions between the character and its enviroment In dark gdk every sprite is given a id number and the way i have been getting my character to navigate through the terrain is by looping through all of the sprites ids and checking for a collision To me this seems very wasteful and i am wondering if there is a more efficient way of doing this? cheers

Share this post


Link to post
Share on other sites
Quote:
Original post by sPOT902
In dark gdk every sprite is given a id number and the way i have been getting my character to navigate through the terrain is by looping through all of the sprites ids and checking for a collision

To me this seems very wasteful and i am wondering if there is a more efficient way of doing this?


If it's running at framerate then it's a perfect solution. If it's running slow and you've identified this part of your code as the bottle neck then you can explore other solutions.

One option would be differentiating between sprites that collide and those that do not. You may also just want to have separate routines for character v ground and bullet v ground/character.

But for a 2D side scroller there's probably no reason to get any more advanced than that unless, as I said, you have identified this as something that is slowing your game down.

If you're already running at 60 or 30 fps (whatever is your target) then there is nothing to optimize.

-me

Share this post


Link to post
Share on other sites
thanks for that, i havent got too far in the game so framerate isnt an issue yet, i was just worried if i designed my collisions around this concept it would slow down the game later, cheers

Share this post


Link to post
Share on other sites

This topic is 2849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this