# Sprite Movement \[RPG Style\]

**URL:** <https://forum.kirupa.com/t/sprite-movement-rpg-style/293410>\
**Category:** flash\
**Created:** [July 28, 2009, 4:16pm UTC](https://forum.kirupa.com/t/sprite-movement-rpg-style/293410 "2009-07-28T16:16:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knuckles1123](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Knuckles1123](https://forum.kirupa.com/u/Knuckles1123)\
**Post date:** [July 28, 2009, 4:16pm UTC](https://forum.kirupa.com/t/sprite-movement-rpg-style/293410/1 "2009-07-28T16:16:56Z")

</div>

Well guys, i have a problem when moving sprites. I manage to make the sprites move and get back to their position after i release the key. But when i stay with the key pressed, the image of the sprites moves, but the animation doesn’t seem like it’s walking. It’s stays frozen.

This is my code:

All the “hero#” are MC

```auto
onClipEvent(load)
{
 step=5;
 movieWidth=300;
 movieHeight=300;
 movieheight1=0;
 this.stop();
}
 
onClipEvent(enterFrame)
{
 if (Key.isDown (Key.RIGHT) && this._x < movieWidth)
  {
  this.attachMovie("hero1", "hero2", 10);
  this._x+=step;
 }
 if (Key.isDown (Key.LEFT) && this._x > 0)
 {
  this.attachMovie("hero3", "hero4", 10 );
  this._x+=-step;
 }
 if (Key.isDown (Key.DOWN) && this._y < movieHeight)
 {
 this.attachMovie("hero5", "hero6", 10 );
 this._y+=step;
 
 }
 if (Key.isDown (Key.UP) && this._y > 0)
 {
 this.attachMovie("hero7", "hero7", 10 );
 this._y+=-step;
}
}

```

This is the SWF so you can judge it by yourself:  
[http://www.petaimg.com/u211/187123qw.swf](http://www.petaimg.com/u211/187123qw.swf)
