PDA

View Full Version : Problem with hitTest


Platypus2008
07-06-2008, 10:12 AM
I've got a bounce pad that a player can bounce on to go high. However sometimes when it lands on the pad the players feet go through the bounce pad. Is there are better way to do this. Here is what I have so far.


if (bounce.hitTestPoint(player.x, player.y + 5, true) && grav > 0)
{
if(bounce.height > 40){grav = 2, bounce.height -= grav, bounce.height --} else {grav = 0, grav = -jumpHeight * 2};
}
else {if (bounce.height < 70) {bounce.height += 5}}
}

bloodstyle
07-06-2008, 01:07 PM
Sometimes it may go through the pad and not register if it's laggy, calculating where you are on the next frame and making your hitTest out from that will help some.