android
  #1  
Old 06-20-2011, 02:11 PM
jameswalker101 jameswalker101 is offline
Junior Member
 
Join Date: Jul 2010
Location: United Kingdom
Posts: 91
Help Moving a sprite?

I am making a Mario game for the Zen. I have made arrow buttons, and drawn them to the screen, but how can I code the LEFT, RIGHT and JUMP, (moving a sprite)
Thanks.

Last edited by jameswalker101; 06-20-2011 at 02:12 PM. Reason: Update
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 06-20-2011, 03:19 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

You just need to keep track of your player's coordinates, and always draw the sprite based on the players current position, and in your LEFT, RIGHT and JUMP functions you modify its coordinates on the screen by adding or subtracting.
That's the quick answer, the long one is for you to check my code for Neko Apprentice, it has arrow buttons which initiates movement.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:03 AM.