Page 1 of 2

Moonwalk

PostPosted: Fri Sep 26, 2008 2:13 am
by BlarghNRawr
I need a code to eliminate moonwalking :D
no urgency

Re: MOOOOOOONwalk

PostPosted: Fri Sep 26, 2008 10:07 am
by edh
Did you look at Sgt Sparkys demo?

Re: MOOOOOOONwalk

PostPosted: Sat Sep 27, 2008 12:30 am
by BlarghNRawr
cant download demos..
can u explain it to me?

Re: MOOOOOOONwalk

PostPosted: Sat Sep 27, 2008 12:54 pm
by jimmynewguy
depends (left and right? left up down right? left up down right + diagonals?)
which 1 do you need explained

Re: MOOOOOOONwalk

PostPosted: Sat Sep 27, 2008 3:39 pm
by BlarghNRawr
just left and right :D

Re: MOOOOOOONwalk

PostPosted: Sun Sep 28, 2008 3:01 am
by jimmynewguy
all right
under draw actor put
Code: Select all
char *key=GetKeyState();

if (key[KEY_LEFT]==1&&key[KEY_RIGHT]==0)x-=5;
else if(key[KEY_LEFT]==0&&[KEY_RIGHT]==1)x+=5


then under keydown right
Code: Select all
char *key=GetKeyState();
if (key[KEY_LEFT]==0&&key[KEY_RIGHT]==1) ChangeAnimation("Event Actor", "walkr", FORWARD);
else if(key[KEY_LEFT]==1&&key[KEY_RIGHT]==1) ChangeAnimation("Event Actor", "standr", FORWARD);\

and
Code: Select all
char *key=GetKeyState();
if (key[KEY_LEFT]==1&&key[KEY_RIGHT]==0) ChangeAnimation("Event Actor", "walkl", FORWARD);
else if(key[KEY_LEFT]==1&&key[KEY_RIGHT]==1) ChangeAnimation("Event Actor", "standl", FORWARD);
for left down
than
Code: Select all
char *key=GetKeyState();
if (key[KEY_LEFT]==1&&key[KEY_RIGHT]==0) ChangeAnimation("Event Actor", "walkl", FORWARD);
else if(key[KEY_LEFT]==0&&key[KEY_RIGHT]==0) ChangeAnimation("Event Actor", "standr", FORWARD);
for right up and finnally
Code: Select all
char *key=GetKeyState();
if (key[KEY_LEFT]==0&&key[KEY_RIGHT]==1) ChangeAnimation("Event Actor", "walkr", FORWARD);
else if(key[KEY_LEFT]==0&&key[KEY_RIGHT]==0) ChangeAnimation("Event Actor", "standl", FORWARD);
for left up

i probably should explain it so.........here goes(gulp)
if bassically checks if key right is up or down and if key left is down or up and changes the animation and directional volocity accordingly just remeber to make sure all the "key ups" and "key downs" are NOT! have repeat disable
(i would tell you again but repeats off :lol: ) so there

Re: MOOOOOOONwalk

PostPosted: Sun Sep 28, 2008 4:46 am
by DilloDude
You could check the method I used in my Samureye demo. That works pretty well.
In short, you subtract whether key_left is pressed from whether key_right is pressed. This means that if both are pressed, or none are pressed, the result is 0. If just right is pressed, it will be 1. If just left, then -1. If it is 0, you set some variable to say you are stopped. Otherwise, you set it to say you are moving, and set another variable to the value to say which direction you are moving in. Later on, you check these variables and move and change animations accordingly.

Re: MOOOOOOONwalk

PostPosted: Sun Sep 28, 2008 4:37 pm
by BlarghNRawr
thanx guys

Re: MOOOOOOONwalk

PostPosted: Fri Oct 03, 2008 12:53 am
by BlarghNRawr
@jimmynewguy:
so can i delete my lwft and right walking codes and just use this instead :?: :?: :?:

also, i just tried this and it sayes there are errors in the first code :(

Re: MOOOOOOONwalk

PostPosted: Sat Oct 04, 2008 5:26 pm
by jimmynewguy
oops misplace semi colin(;)
Code: Select all
char*key=GetKeyState();
if (key[KEY_LEFT]==1&&key[KEY_RIGHT]==0)x-=5;
else if(key[KEY_LEFT]==0&&key[KEY_RIGHT]==1)x+=5;


there
and yes delete other walking scripts :D

Re: MOOOOOOONwalk

PostPosted: Sat Oct 04, 2008 5:29 pm
by BlarghNRawr
i fixed the ; before, and it said there was a problem with line 1
cant covert char to * or something strange :|

Re: MOOOOOOONwalk

PostPosted: Sat Oct 04, 2008 6:53 pm
by jimmynewguy
ya i fixed that with
Code: Select all
char*key=GetKeyState();
if (key[KEY_LEFT]==1&&key[KEY_RIGHT]==0)x-=5;
else if(key[KEY_LEFT]==0&&key[KEY_RIGHT]==1)x+=5;

this^
(key)
:lol:

Re: MOOOOOOONwalk

PostPosted: Sat Oct 04, 2008 7:35 pm
by BlarghNRawr
ok i try it :D

Re: MOOOOOOONwalk

PostPosted: Sat Oct 18, 2008 2:07 am
by BlarghNRawr
actually the control is W.A.S.D. A is left, D is right, so would it be:
Code: Select all
char*key=GetKeyState();
if (key[KEY_A]==1&&key[KEY_D]==0)x-=5;
else if(key[KEY_A]==0&&key[KEY_D]==1)x+=5;

Re: Moonwalk

PostPosted: Wed Mar 18, 2009 4:41 pm
by BlarghNRawr
OK everything worked perfectly, however, there is another moonwalking problem if you hold down to crouch, and then start to move and release crouch, you will simply slide...
ive had this problem for a long time, im just too lazy to ask how to fix it...

here is the codes for left down (a), right down (d), draw actor, key up left (a), key up right (d), key down down (s) and key up down (s)


they are all screenshots tho =D