View Full Version : Character Movement with with animation?
ze straw
09-07-2008, 02:32 AM
I created this and made him move and then did the same thing for the other side. But how do I get him to move with the arrow keys while showing the walk sequence, then when you let go of the arrow key he goes back to his normal standing posion. I figured out how to do it but not how to do it with an animated guy:confused:.
Thanks!
Ze Straw;)
ze straw
09-07-2008, 09:15 PM
Ok so I have this walking script, and I wanted to make it where when you move to the left (left arrow key) the guy shows the walking left animation and when you go to the right he shows the walking right animation (right arrow key)
Here is the script:
onClipEvent(enterFrame){
stop();
if(Key.isDown(Key.RIGHT)){
this._x += 5;
this.gotoAndStop(right);
}else{
stop();
this.gotoAndStop(15);
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;
this.gotoAndStop(left);
}else{
stop();
this.gotoAndStop(1);
}
if(Key.isDown(Key.UP)){
this._y -= 5;
}
if(Key.isDown(Key.DOWN)){
this._y += 5;
}
}
But when I test the scene the dude moves, but it doesn't show the walking animation. It just shows the hero guy still, and when I go to the left with the arrow key it doesn't show the "left animation". If anyone could show me what I'm doing wrong that would be cool!
The game - http://www.rapidshare.com/files/143442448/Lusdonia.zip.html
Thanks!
Ze straw:)
ze straw
09-07-2008, 10:58 PM
Ok so I have this walking script, and I wanted to make it where when you move to the left (left arrow key) the guy shows the walking left animation and when you go to the right he shows the walking right animation (right arrow key)
Here is the script:
onClipEvent(enterFrame){
stop();
if(Key.isDown(Key.RIGHT)){
this._x += 5;
this.gotoAndStop(right);
}else{
stop();
this.gotoAndStop(15);
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;
this.gotoAndStop(left);
}else{
stop();
this.gotoAndStop(1);
}
if(Key.isDown(Key.UP)){
this._y -= 5;
}
if(Key.isDown(Key.DOWN)){
this._y += 5;
}
}But when I test the scene the dude moves, but it doesn't show the walking animation. It just shows the hero guy still, and when I go to the left with the arrow key it doesn't show the "left animation". If anyone could show me what I'm doing wrong that would be cool!
The game - http://www.rapidshare.com/files/143442448/Lusdonia.zip.html
Thanks!
Ze straw
ViolentAJ
09-08-2008, 08:21 PM
gotoAndStop(right) should be gotoAndStop("right").
You have to use quotes. Don't forget to properly label your frames.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.