would this work? trying to modify movement code for attacks

Non-platform specific questions.

would this work? trying to modify movement code for attacks

Postby DollMaster » 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
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;
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score

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

Postby Bee-Ant » Wed Sep 12, 2007 9:36 am

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:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

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

Postby DollMaster » Wed Sep 12, 2007 10:13 pm

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.
DollMaster
 
Posts: 65
Joined: Fri Jun 16, 2006 2:38 am
Score: 2 Give a positive score

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

Postby Rux » Thu Sep 13, 2007 2:46 am

*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:
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest