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}}
}
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}}
}