Hi
I’ve encountered a problem while coding my character to jump in my game. My character just goes up and stayed there and not coming down. I need it to jump up and then come back down when user press the keyboard arrow UP. I’ve define isUp =true when key is pressed and set it back to false when user release key release. I’ve search many tutorials and the codes seems short and simple but I find it quite confusing.
i followed a tutorial, my character will go up but wouldnt come down. Cant figure out what’s wrong with the code. Can anyone help me with this or maybe help point out to me how i should code this please… Thanks~
function onLoop(evt:Event):void
{
dy+=gravity;
if(ninja_mc.y<400)
{
dy=0;
isJumping = true;
}
if(isUp && isJumping)
{
dy =-10;
isJumping=false;
}
ninja_mc.y +=dy;
}