by yourownskills » Sat Mar 24, 2012 10:35 am
im trying to get my character to attack facing right as well as attacking when facing left..and while jumping...
i did ADD EVENTS key Down...change animation
I followed a tutorial on youtube for the bottom code, i dont really understand it. Im a graphics guy. So I tried adding the attack animations differently from what i learned in a different tutorial.
this is in my Player--Draw Actor.....so i can move left and right and jump
char *key=GetKeyState();
int dir=key[KEY_RIGHT]-key[KEY_LEFT];
int j=key[KEY_SPACE];
switch(dir)
{
case 0: //none or both
if(animindex==0)
{
ChangeAnimation("Event Actor", "charStopLeft", NO_CHANGE);
}
else if(animindex==1)
{
ChangeAnimation("Event Actor", "charStopRight", NO_CHANGE);
}
break;
case -1: //Left
Collider. x-=5;
ChangeAnimation("Event Actor", "charLeft", NO_CHANGE);
break;
case 1: //Right
Collider. x+=5;
ChangeAnimation("Event Actor", "charRight", NO_CHANGE);
break;
}
if(Collider.yvelocity<10)
Collider.yvelocity+=.5;
switch(j)
{
case 0:
break;
case 1:
if(!jump)
{
Collider.yvelocity=-10;
jump=1;
}
break;
}
- Attachments
-
-