this is my main player script
which makes him walk, and jump.
- Code: Select all
char*key=GetKeyState();
int spd = 5;
lay = 0;
yvelocity += gravity;
if(damage > 100)DestroyActor("Event Actor");
if(wt > 0)wt--;
else
if(key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 0)
{
if(j == 0 && xvelocity > -spd)xvelocity--;
if(j == 1)x -= spd;
if(ld == 1)
{
ld = 0;
af = 1;
}
if(af == 1)
{
ChangeAnimation("Event Actor", "RANDAL- pistols left walk 1", FORWARD);
af = 0;
}
}
if(key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 1)
{
if(j == 0 && xvelocity < spd)xvelocity++;
if(j == 1)x += spd;
if(ld == 0)
{
ld = 1;
af = 1;
}
if(af == 1)
{
ChangeAnimation("Event Actor", "RANDAL- pistols right walk 1", FORWARD);
af = 0;
}
}
if(key[KEY_LEFT] == 0 && key[KEY_RIGHT] == 0)
{
af = 1;
if(ld == 0)ChangeAnimation("Event Actor", "RANDAL pistol left", FORWARD);
else ChangeAnimation("Event Actor", "RANDAL pistol right", FORWARD);
}
if(key[KEY_LEFT] == 1 && key[KEY_RIGHT] == 1)
{
af = 1;
if(ld == 0)ChangeAnimation("Event Actor", "RANDAL pistol left", FORWARD);
else ChangeAnimation("Event Actor", "RANDAL pistol right", FORWARD);
}
if(j == 1 && key[KEY_z] == 1)
{
if(key[KEY_LEFT] == 1)xvelocity = -spd;
if(key[KEY_RIGHT] == 1)xvelocity = spd;
yvelocity = -(gravity * 13);
j = 0;
}
..
as you can see i added a varibale "lay = 0;"
im trying to add when down is held down my actor crawls
but im having a whole heap of trouble adding it into my code.
i have already added in
keydown- down = lay = 1
keyup - down = lay = 0
any ideas?