Computer Science Canada

Help with Jumping Sprite

Author:  MC [ Tue Jun 16, 2009 8:53 pm ]
Post subject:  Help with Jumping Sprite

So im trying to make a platformer game so that by pressing the up arrow key my sprite jumps and then falls due to gravity but when i hold the up arrow ke down i want the sprite to jump higher and possibly fall slower. So far i have the first part with the jumping and the falling but i dont know how to detect if the up arrow key is held down, so my question is how do you detect when a key is held down. here is some of the code i am using:

if keys (KEY_UP_ARROW)
yPosition += 50
end if

if yPosition > 0 then
yPosition -= 1
end if

P.S. sorry if my format or how ive written this is bad, im new to this site and the link to the site rules page wasn't working.


: