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”);
}
}