Collision help

BlitzMax Forums/BlitzMax Programming/Collision help

RetroRusty(Posted 2009) [#1]
I'm having some problems trying to get my head around collisions for a platform game.

I've not used BlitzMax to any extent before and would ask if any of you could please have a look at the file in the link and help me out with it?

http://www.enigma.retroremakes.com/russ/BuildMap.zip


matibee(Posted 2009) [#2]
Whats your problem?

I noticed he falls into the level then can't walk... Line 117 moves the player down, then you check for collision. But if a collision has occured the player will be embedded in the level. Change line 120 to

PlayerY = PlayerY - 2.8

to put him back to where he was.


RetroRusty(Posted 2009) [#3]
It's still not right. He's able to jump into parts of the level. If you move him to the left and try and jump on the level, you will see what I mean.


matibee(Posted 2009) [#4]
Ok, Russ

Some notes;

First; checking playerX + 16 and playerX + 32 is too far over. You'd have to check PlayerX,PlayerX+16 AND PlayerX+32. Instead check half the tile width.. PlayerX + 8 and PlayerX + 24 which does a good job of averaging the correct two tiles to check.

Second; checking for stopping a fall should be an OR not an AND check. You only stopped a fall if both tiles below are occupied, when you should stop if either one is!

Third; I added a little re-adjustment to playerY so he always stops on the ground (see the While/Wend)..

Hope that helps