I want to assign each animation a value. there will be 8. movement and stopped. Sewn inside of the code below I will add code to assign those values.
Now, For my key up event on the attack key depending on the value, the animation will change to that.
However, I still need to find a way to make an animation only play once. baby steps. baby steps.
KEY DOWN - left
- Code: Select all
char *key=GetKeyState();
if (key[KEY_UP]==0&&key[KEY_RIGHT]==0&&key[KEY_DOWN]==0)
ChangeAnimation("Event Actor", "run_left", FORWARD);
else if (key[KEY_UP]==1&&key[KEY_RIGHT]==0&&key[KEY_DOWN]==0)
ChangeAnimation("Event Actor", "run_up", FORWARD);
else if (key[KEY_UP]==0&&key[KEY_RIGHT]==1&&key[KEY_DOWN]==0)
ChangeAnimation("Event Actor", "stop_right", FORWARD);
else if (key[KEY_UP]==0&&key[KEY_RIGHT]==0&&key[KEY_DOWN]==1)
ChangeAnimation("Event Actor", "run_down", FORWARD);
else if (key[KEY_UP]==0&&key[KEY_RIGHT]==1&&key[KEY_DOWN]==1)
ChangeAnimation("Event Actor", "run_down", FORWARD);
else if (key[KEY_UP]==1&&key[KEY_RIGHT]==1&&key[KEY_DOWN]==0)
ChangeAnimation("Event Actor", "run_up", FORWARD);
else if (key[KEY_UP]==1&&key[KEY_RIGHT]==0&&key[KEY_DOWN]==1)
ChangeAnimation("Event Actor", "run_left", FORWARD);
KEY UP - left
- Code: Select all
char *key=GetKeyState();
if (key[KEY_UP]==0&&key[KEY_DOWN]==0&&key[KEY_RIGHT]==0)
ChangeAnimation("Event Actor", "stop_left", FORWARD);
else if (key[KEY_UP]==1&&key[KEY_DOWN]==0&&key[KEY_RIGHT]==0)
ChangeAnimation("Event Actor", "run_up", FORWARD);
else if (key[KEY_UP]==0&&key[KEY_DOWN]==1&&key[KEY_RIGHT]==0)
ChangeAnimation("Event Actor", "run_down", FORWARD);
else if (key[KEY_UP]==0&&key[KEY_DOWN]==0&&key[KEY_RIGHT]==1)
ChangeAnimation("Event Actor", "run_right", FORWARD);
else if (key[KEY_UP]==1&&key[KEY_DOWN]==1&&key[KEY_RIGHT]==0)
ChangeAnimation("Event Actor", "stop_left", FORWARD);
DRAW ACTOR
- Code: Select all
char *key=GetKeyState();
if (key[KEY_UP]==1) y-=2;
if (key[KEY_DOWN]==1) y+=2;
if (key[KEY_LEFT]==1) x-=2;
if (key[KEY_RIGHT]==1) x+=2;