Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with Jumping Sprite
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MC




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: