Well.. I'm working on a flash game (platformer), and I've made a walking animation. No matter how hard I try it simply walks all the time (or is not walking at all).. can anyone help me limit the walking to when you push the directional keys?
i have a simple "code" for this at home. right now, im at school, but ill try and describe it as much as possible. in your movie clip, make a frame on your charracter simply standing still(frame 1), one of your character going left (frame 2) and one of your character going right (frame 3)
now, back to the main stage, select your character movie clip and insert the code below into the action pannel. *Reminder : this code might be incorrect, i will post a good version in few hours. i am only posting this because its URGENT!
//start script here onClipEvent (load) { walkSpeed = 5; //defines walking speed } onClipEvent (enterFrame) { //so it starts every frame if (Key.isDown(key.RIGHT)) { _x+= walkSpeed; //moves clip right gotoandstop(3) //animation on character going right }else{ //the else is very important, it makes it possible that if neither key is pressed, character plays animation 1 if (Key.isDown(key.LEFT)) { _x-= walkSpeed; gotoandstop(2) }else{ gotoandstop(1) } } } warning, brackets might be missing
well, your code can work if you animation is isometric, and it works easely for moving up/down/left/right, but you're forgetting he's making a platformer. the use of the gotoandstop sends you to the moving animation