# Flash 5, move character help

**URL:** <https://forum.kirupa.com/t/flash-5-move-character-help/7280>\
**Category:** Uncategorized\
**Created:** [October 27, 2002, 11:22am UTC](https://forum.kirupa.com/t/flash-5-move-character-help/7280 "2002-10-27T11:22:37Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 2:04pm UTC](https://forum.kirupa.com/t/flash-5-move-character-help/7280/21 "2002-11-10T14:04:16Z")

</div>

i have now changed my code so it is more efficient but nothing seems to work could u please help?

stop ();  
function initGame () {  
// create the stickman  
attachMovie(“stickmanwalk”, fred, 20);  
fred.\_x = 275;  
fred.\_y = 150;  
attachMovie(“stickmandance”, jim, 20);  
}  
function movestickman () {  
// check for arrow keys  
if (Key.isDown(Key.RIGHT)) {  
dx = 5;  
} else if (Key.isDown(Key.LEFT)) {  
dx = -5;  
} else {  
// no movement  
dx = 0;  
}  
// move the stickman and limit that movement  
fred.\_x += dx;  
if (fred.\_x\<30) {  
fred.\_x = 30;  
}  
if (fred.\_x\>520) {  
fred.\_x = 520;  
}  
// make the stickman run or stand still  
if (dx != 0) {  
fred.gotoAndPlay(“stickmanwalk”);  
} else {  
jim.\_x = fred.\_x;  
jim.\_y = fred.\_y;  
jim.gotoAndPlay(“stickmandance”);  
}  
}

[Previous page](https://forum.kirupa.com/t/flash-5-move-character-help/7280.md?page=1)
