hey guys!

i was just wondering all these large games make use of footholds to make a character stay

is there any way in C++ to make simple footholds?

im making a stick platform game and am tired of using collision checking to make it work all the time for every single platform.

is there any way to make a foothold and apply it onto a platform so that the stickman can stand on it besides collision checking?

Recommended Answers

All 2 Replies

For a 2D game you should look into quadtrees (octrees for 3D games). What this does is it helps you manage how many objects you are checking collision against or drawing on each collision check and draw.

Since you have 50 platforms in level 1 and every time the scene recalculates you have to check against all those objects to see if you are touching them. What you should do is divide those 50 platforms into 4 nodes. Then divide each node into another 4 trees until you are down to a reasonable amount of objects in each node. When you load in your level you will do a one time check to set all the platforms into these nodes and then you do not need to move them around again.

On each recalculation of the scene you will check your stick man's box against each node and then you only need to check collision/draw the objects that might be being touched/displayed.

I made a tile game that did not use "sectors" and it lagged because it had to constantly check against hundreds of tiles on each recalculation. Then I modified the game to use sectors so it was only checking against a few tiles each time.

ohhh! wow that helps a lot specially cause it relates to what im making ! thank you so much for the great help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.