Page 1 of 1

would this work? trying to modify movement code for attacks

PostPosted: Wed Sep 12, 2007 12:06 am
by DollMaster
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
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;

Re: would this work? trying to modify movement code for attacks

PostPosted: Wed Sep 12, 2007 9:36 am
by Bee-Ant
Ough...that's a difficult codes... :(
Make a code with Keydown and keyup event "one by one" I think a simple and easy way... :roll:
What's the action which you want..tell me, maybe I can help you with my simple code??? :lol:

Re: would this work? trying to modify movement code for attacks

PostPosted: Wed Sep 12, 2007 10:13 pm
by DollMaster
well this code is going to go one by one, but modified depending on what key it is. This code prevents moonwalking, I just want to be able to add additional action buttons without it screwing up anti-moonwalking. Thats all. Thats all I want out of life.

Re: would this work? trying to modify movement code for attacks

PostPosted: Thu Sep 13, 2007 2:46 am
by Rux
*Sits there staring at the code drooling, 5 years later "Uh... what exactly am I looking at, gibberish or some phony explanation on why dinosaurs never existed, but where rocks that formed in the shapes of bones?* lol :lol: