This is a script for a character that walks in 4 directions. That works fine. I have also added other random movieclip animations for other keystrokes.
I want a movie clip to play through when a key is pressed. Right now the movieclip only plays while the key is being held. How do I get it to continue to play even if the key is released? I am not sure if I need to add something to my action script or change it entirely.
Here is my script:
onClipEvent(loa d) {
speed = 5;
grow = 3;
}
onClipEvent(ent erFrame){
if(Key.isDown(4 9)){
this.gotoAndSto p("right");
this._x+=speed;
}else if(Key.isDown(5 0)){
this.gotoAndSto p("left");
this._x-=speed;
}else if(Key.isDown(5 1)){
this.gotoAndSto p("back");
this._xscale -= this.grow;
this._yscale -= this.grow;
}else if(Key.isDown(5 2)){
this.gotoAndSto p("front");
this._xscale += this.grow;
this._yscale += this.grow;
}else if(Key.isDown(5 3)){
this.gotoAndSto p("crazy");
}else if(Key.isDown(5 4)){
this.gotoAndSto p("snowball") ;
}else{
this.gotoAndSto p("stand")
}
}
Any suggestions would be appreciated!
I want a movie clip to play through when a key is pressed. Right now the movieclip only plays while the key is being held. How do I get it to continue to play even if the key is released? I am not sure if I need to add something to my action script or change it entirely.
Here is my script:
onClipEvent(loa d) {
speed = 5;
grow = 3;
}
onClipEvent(ent erFrame){
if(Key.isDown(4 9)){
this.gotoAndSto p("right");
this._x+=speed;
}else if(Key.isDown(5 0)){
this.gotoAndSto p("left");
this._x-=speed;
}else if(Key.isDown(5 1)){
this.gotoAndSto p("back");
this._xscale -= this.grow;
this._yscale -= this.grow;
}else if(Key.isDown(5 2)){
this.gotoAndSto p("front");
this._xscale += this.grow;
this._yscale += this.grow;
}else if(Key.isDown(5 3)){
this.gotoAndSto p("crazy");
}else if(Key.isDown(5 4)){
this.gotoAndSto p("snowball") ;
}else{
this.gotoAndSto p("stand")
}
}
Any suggestions would be appreciated!
Comment