-
gotoAndStop won't play the clip that it goes to
Hi, i have a problem :/
im making a fighting-style game, and need to make it so that when the left or right button is pressed, the character (which is on frame 1, standing still), switches to frame 2, an animation of him walking. However, with the code i have,
if (Key.isDown(Key.LEFT)) {
walk = true;
wspeed = -walkspeed;
this._xscale = -100;
} else if (Key.isDown(Key.RIGHT)) {
walk = true;
wspeed = walkspeed;
this._xscale = 100;
}
if (!Key.isDown(Key.RIGHT) and !Key.isDown(Key.LEFT)) {
walk = false;
}
if (crouch) {
this.gotoAndStop(3);
}
if (walk and !crouch) {
this._x += wspeed;
if (this.currentFrame !== 2) {
this.gotoAndStop(2); }
(ignore the crouch)
, the player goes to frame 2 but the animation on frame 2 does not play, instead, it just seems to hang on the first frame.
any help? thanks!
-
is the animation a movieclip on frame 2, or does it start on frame 2 to like say end on frame 20? without seeing it, my only answer woiuld be that you are telling the movie to go to and STOP on frame 2. with STOP being the keyword.
If you have a movieclip on frame 2 that you want to play an animation, on frame two you would have to put: myAnimation_mc.play();
make sense?
Like I said, without seeing it, it's hard to tell how it is built.
IMS
-
=) thanks IMS!
yes, i meant i had an animation on frame 2.
i did what you suggested and it worked fine! thanks
-
Just remember to put Stop(); on the last frame of the animation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|