Hey guys,
I am progressing to tile-based concepts. I implemented this simple example to draw tiles and execute tile physics and logic. I am encountering complications however. My character is falling through the floor although I am certain that my collision routines are correct. If you need to see them, I will post them. Does anyone have any ideas?
post your is_colliding routine.
The reason I have that particular section of code commented off was for simplicity's sake. I only wanted to keep the character from falling through the ground.
Might help if I knew what this "cage" thing is.
I apologize. The concept of the cage is the bounding box around the entity.
Top Left Corner (x, y)
Top Right Corner (x, y)
Bottom Left Corner (x, y)
Bottom Right Corner (x, y)
Center (x, y)
Hmm, well, look at the logic in the executeDrawing function (which in fact is also doing logic not just drawing, which is always bad). I'm pretty sure you don't want your character to fall a pixel for every tile you check against. You should set a flag before that loop, bool colliding = false; Then in the loop, if your character collides with something, set colliding = true; and break out of the loop. After the loop, if the colliding is false, then move the character down a pixel.
Thanks Trent.
Ah yes, that logic section was not supposed to be there when I posted it because I thought I cut it and placed it in the logic section, but thanks.