Archived

This topic is now archived and is closed to further replies.

sprites movement

This topic is 5537 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using the scrolling game developer from this site. I ''m having trouble controlling the animation of a sprite. I need to control the movement so it looks like the sprite is being controlled by the arrows. The animation keeps looping even after i let go of the arrow keys. If anyone could help me i would appreciate it.

Share this post


Link to post
Share on other sites
Update your frames by input like this;

sprite.frame[n];

if(KEYDOWN(VK_RIGHT)
{
i++;
if(n>5)
n=0;
}


Then the sprite will animate while the player is holding the keydown. You then just have to test when the key is not being pressed and make the animation the standing frame.

"Act in haste and repent at leisure; code to soon and debug forever"
-Raymond Kennington

[Edit: 'i' is not a good choice of variable for indexing on this site because the sequence [i] is interpreted by the forum software as an italics metatag. You should also use the [code][/code] and [source][/source] metatag pairs to retain formatting and/or gain syntax highlighting, etc. See site FAQ for details.]

[edited by - Oluseyi on October 21, 2002 12:18:29 PM]

Share this post


Link to post
Share on other sites
If you are referring to the Scrolling Game Development Kit, I recommend you post questions at the Scrolling Game Development Kit Forums where they will be seen by me more often

To answer this question, I believe you simply have to check the box to associate the animation speed with the movement speed. Please join us at the forums mentioned above and let me know if this does or doesn't work for you.

"All you need to do to learn circular logic is learn circular logic"

[edited by - bluemonk on October 21, 2002 11:46:52 AM]

Share this post


Link to post
Share on other sites