View Full Version : SceneAnimationProblems
Lord Rahl
March 1st, 2005, 06:56 PM
Ok, this is a problem I noticed that when people ask about they get the same replies. "Check tutorials or Don't use scenes". Problems with going from scene to scene and still have your character movement work. The following Swf file explains a little more. I figure its time to figure out this problem and a way around it. If you reply please do not reply with "Check tutorials or Don't use scenes". Thanks
Rossman
March 1st, 2005, 09:00 PM
Post the FLA I'll have a look.
I never understood why one would use scenes, but it's worth looking into just for the fun of it ;)
JoMan
March 1st, 2005, 09:56 PM
I never understood why one would use scenes, but it's worth looking into just for the fun of it ;)
It keeps your frames clean, but it also can become very aggitating when remembering what frame you are on.
kanpai
Lord Rahl
March 2nd, 2005, 02:35 PM
Here is the flash version of this problem. In a zip folder.
Rossman
March 2nd, 2005, 02:55 PM
Hmmm, um, the character movement works for me across both scenes. You are saying it doesn't work for you?
Lord Rahl
March 2nd, 2005, 03:00 PM
Yea. In the scene with the ninja character it works with movement but when you stop moving rather than face the direction you last moved it faces down and continues to walk. Kinda odd and I noticed this happened for a few other people before aswell. Perhaps I need to update my flash??? or could it be with the program in general?
Rossman
March 2nd, 2005, 04:04 PM
No I am not getting that with your code. The ninja (black) guy walks fine and when you stop pressing the arrow keys he stops. He does turn and face the wrong direction, but he doesn't keep walking...
Rossman
March 2nd, 2005, 04:48 PM
I think you have a variable pathing problem. I am still checking into it but it's not scenes it's your code.
Lord Rahl
March 2nd, 2005, 06:05 PM
I think you have a variable pathing problem. I am still checking into it but it's not scenes it's your code.
Thats what I thought it was as well and can't seem to find the problem. But I think its near the end of the code.:puzzled:
Rossman
March 2nd, 2005, 06:21 PM
I got the guy to at least face the right direction when you let go of the arrow keys, but he still stands there doing the continuous walking in place animation, not sure how to stop that...
Lord Rahl
March 2nd, 2005, 06:32 PM
I got the guy to at least face the right direction when you let go of the arrow keys, but he still stands there doing the continuous walking in place animation, not sure how to stop that...
I managed to make it so he stoped walking continously.... but then he always faces right. Then I messed around with it some more and totaly messed up he script. Gotta start over. :angry:
Rossman
March 2nd, 2005, 06:43 PM
Yo, your MAIN problem is that you aren't using gotoandPlay correctly. Well, you are, but you aren't using the proper case (you don't have the "A" in "and" uppercase as it needs to be).
This is some code I updated on the sprite in Scene 3:
onClipEvent (load) {
moveSpeed=5;
_root.walkingState = "down";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
gotoAndStop ("right");
_root.walkingState = "right";
this._x+=moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
gotoAndStop ("left");
_root.walkingState = "left";
this._x-=moveSpeed;
} else if (Key.isDown(Key.DOWN)) {
gotoAndStop ("down");
_root.walkingState = "down";
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
gotoAndStop ("up");
_root.walkingState = "up";
this._y-=moveSpeed;
}
else{
gotoAndPlay(_root.walkingState);
//walkingState = "";
}
}
So this code seems to work fine except there is something about how your sprite movie clip is constructed that causes the sprite to turn the wrong way when you finish moving him
I have isolated this down to how the sprite is working. For example you will notice if you move to the right the guy will stop just fine (facing right). However if you move left and stop, the guy will face right upon stopping. This is because the playback head is not stopping where it should in your sprite - it's going one "direction" too far.
So if you stop him walking up, he'll face up. If you stop him walking up, he'll face left, and if you stop him walking left, he'll face right. If you walk him right, he will stay facing right.
I hope this helps you in some regards, I wasn't able to figure out why you did some stuff how you did it so I can't give you a more complete answer.
Cheers,
mark
Lord Rahl
March 2nd, 2005, 07:16 PM
Yo, your MAIN problem is that you aren't using gotoandPlay correctly. Well, you are, but you aren't using the proper case (you don't have the "A" in "and" uppercase as it needs to be).
This is some code I updated on the sprite in Scene 3:
onClipEvent (load) {
moveSpeed=5;
_root.walkingState = "down";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
gotoAndStop ("right");
_root.walkingState = "right";
this._x+=moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
gotoAndStop ("left");
_root.walkingState = "left";
this._x-=moveSpeed;
} else if (Key.isDown(Key.DOWN)) {
gotoAndStop ("down");
_root.walkingState = "down";
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
gotoAndStop ("up");
_root.walkingState = "up";
this._y-=moveSpeed;
}
else{
gotoAndPlay(_root.walkingState);
//walkingState = "";
}
}
So this code seems to work fine except there is something about how your sprite movie clip is constructed that causes the sprite to turn the wrong way when you finish moving him
I have isolated this down to how the sprite is working. For example you will notice if you move to the right the guy will stop just fine (facing right). However if you move left and stop, the guy will face right upon stopping. This is because the playback head is not stopping where it should in your sprite - it's going one "direction" too far.
So if you stop him walking up, he'll face up. If you stop him walking up, he'll face left, and if you stop him walking left, he'll face right. If you walk him right, he will stay facing right.
I hope this helps you in some regards, I wasn't able to figure out why you did some stuff how you did it so I can't give you a more complete answer.
Cheers,
mark
Ahh I did not notice that about the A. lol. Thanks for the help so far though.
Lord Rahl
March 11th, 2005, 08:17 PM
This is just a post to bump this up a bit again to see if anyone can figure out this problem. I have managed to get it to face the direction it is supposed to when stoped but it continues walking. Unforunitly I don't remember what I put in to fix it that much because I added more in and screwed it up again. But any help on fixing this torcherous problem will be helpfull and make me gratefull.
Grake
March 13th, 2005, 09:36 AM
Erm is there a flash mx version? i dun have flash 2004...?
Lord Rahl
March 13th, 2005, 05:52 PM
Unfortunitly no. Sorry. But the script is listed in the posts above and here is a swf version to show you the prob.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.