hey guys!

ive spent another 3 hours trying to find out what is wrong with my code! i tried many ideas that came into my head but they didnt work :(

here is my code.. ive narrowed my problem and shown where it could possibly be by enlarging and making bold the code.

Google Docs : Source Code

the problem is the collision detection in the function check_collision() .. the function Platform::show() works perfectly which means the function Platform::set_clips() also has no problem.. i cant seem to find whats wrong with the check_collision() function

please help me find this error .. it is getting frustrating :@

Thanks a lot once again!
this forum has been very helpful and kind :)

5 Years
Discussion Span
Last Post by ChaseRLewis

You started out right with if(bottomA < topB) . The proceeding three if statements would not give you the desired result though. You need to compare left to right, and top to bottom. For instance:

if(bottomA < topB)
    return false;
if(bottomB < topA)
    return false;
if(rightA < leftB)
    return false;
if(rightB < leftA)
    return false;

Edited by nmaillet: n/a


no man this is wrong even after i read your code it doesnt make sense .. have you read through the code in the Platform::set_clips() function?

also this code works when i put constant values and remove the arrays eg. levelOneX = 100; for all the values so it is a problem with reading them that i can't figure out :o

Thanks for trying to help though.. appreciate it :)


Well first off you haven't stated the problem so I'm assuming things are colliding but your getting failed collision detections?

Meh don't want to read through the code without knowing exactly what ISN'T working.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.