Members - Reputation: 184
Posted 23 May 2012 - 11:52 AM
Members - Reputation: 187
Posted 26 May 2012 - 12:30 PM
if(rect1.y + rect1.height <= rect2.y && rect1.Intersects(rect2))
Then in this instance rect1 is colliding to the top of rect2. I could be wrong though, these things can sometimes be deceptively simple
Another approach would be to have 1 large bounding rectangle, and 4 smaller rectangles representing his head/rhs/lhs/feet. The large rectangle would be a quick check to see if anything is likely to collide, then depending on which smaller rectangle it collides with, you make the appropriate reaction to it.
These smaller rectangle idea could be helpful for things like walking on a platform, you only want "Gravity" to stop if his feet are collding with something etc.
Edited by dAND3h, 26 May 2012 - 12:33 PM.