Greetings all,
I am attempting to build an rpg combat engine, and all seems to be going well, except one thing - my animations are not playing correctly.
In the player_mc, I have 4 frames, each containing a movie clip animation, and the stop(); actionscript, as follows:
Frame 1: playerIdle_mc
Frame 2: playerAttack_mc
Frame 3: playerMagic_mc
Frame 4: playerDead_mc
I have an enemy_mc that is set up exactly the same, excepting that player is replaced with enemy.
Here is a small sample of the code, that I think should be relevant and specific enough to explain the problem:
if (pAtt == true) { //If player is attacking
[INDENT]player_mc.gotoAndStop(2); //display the attack animation
eHP -= 1; //damage the enemy
pAtt = false; //the attack is over
pTurn = false; //the turn is over
if (eHP <= 0) { //if enemy hp 0 then he’s dead
[INDENT]eIsDead = true;
[/INDENT]} else { //otherwise it’s his turn
[INDENT]eTurn = true;
[/INDENT]}
player_mc.gotoAndStop(1); //display player’s idle animation
[/INDENT]}
Now, prior to attacking, the player_mc was displaying the idle animation, and through this attack routine, it continues doing so - it snaps to the default position I have set up so the animations blend, but then continues to display the idle animation. I think it may actually be going there and trying to display it, but something is missing and it goes backl to idle, which i tell it to do at the end of the attack.
I am pretty certain the problem lies in the code “player_mc.gotoAndStop(2);”
I think somehow I’m supposed to detect how many frames the animation is and make the game pause while it plays the animation, but I’m not certain if that’s correct, or if it is, how to do it.
Any advice on this would be greatly appreciated.
Thank you in advance
-J-