In each key down event, depending on what direction he is faceing/move state, I have the variable DIR assigned a value.
- Code: Select all
if (key[KEY_UP]==0&&key[KEY_LEFT]==0&&key[KEY_RIGHT]==0)
{ChangeAnimation("Event Actor", "run_down", FORWARD);
dir=1;}
The DIR variable is assigned on my key up event too.
- Code: Select all
if (key[KEY_UP]==0&&key[KEY_LEFT]==0&&key[KEY_RIGHT]==0)
{ChangeAnimation("Event Actor", "stop_down", FORWARD);
dir=1;}
The DIR variable also determines what animation occurs when the players attacks.
- Code: Select all
if(dir==1||dir==5)
{ChangeAnimation("Event Actor", "heroa", FORWARD);}
else if(dir==3||dir==7)
{ChangeAnimation("Event Actor", "heroau", FORWARD);}
else if(dir==2||dir==6)
{ChangeAnimation("Event Actor", "heroal", FORWARD);}
else if(dir==4||dir==8)
{ChangeAnimation("Event Actor", "heroar", FORWARD);}
Code still works like I want except player continuesly does his attack animation.
When these attack animations finish, I want to go back to whatever movement/stand still animation he is supposed to go to depending on the variable DIR.
So I entered this code as an animation finish event, for player attack down animation.
- Code: Select all
if(dir==1)
{ChangeAnimation("Event Actor", "stop_down", FORWARD);}
if(dir==3)
{ChangeAnimation("Event Actor", "stop_up", FORWARD);}
else if(dir==2)
{ChangeAnimation("Event Actor", "stop_left", FORWARD);}
else if(dir==4)
{ChangeAnimation("Event Actor", "stop_right", FORWARD);}
else if(dir==5)
{ChangeAnimation("Event Actor", "run_down", FORWARD);}
else if(dir==7)
{ChangeAnimation("Event Actor", "run_up", FORWARD);}
else if(dir==6)
{ChangeAnimation("Event Actor", "run_left", FORWARD);}
else if(dir==8)
{ChangeAnimation("Event Actor", "run_right", FORWARD);}
But he no longer does his attack animation and just stands there. What am I doing wrong? Isn't animation finish supposed to cause something to happen when the animation cycles through all of its frames?