would this work? trying to modify movement code for attacks
Posted: Wed Sep 12, 2007 12:06 am
I think I got it! But I want to see if you guys think it will work before I try it. This is the movement code I found via the search feature(one that i like). I have a key down event that changes animation to the attack animation. But it stays that animation when you press it.
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
KEY UP - left
DRAW ACTOR
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;