[SOLVED]Actor Spawning Issue
Posted: Wed May 15, 2013 9:42 pm
Hello, I am trying to add thruster graphics to my player however it keeps spawning the actor every cycle, and no matter what I do... I cannot seem to fix it.
Here is the code:
Here is the code:
- Code: Select all
char *key=GetKeyState();
int dir=key[KEY_RIGHT]-key[KEY_LEFT];
int fly=key[KEY_UP]-key[KEY_DOWN];
int ThrustLeft=0;
switch(dir)
{
case 0: //None or Both
ChangeAnimation("Hover", "magneto_hover5x1_normal", NO_CHANGE);
ThrustLeft=0;
break;
case -1: //Left
x-=5;
view.x-=5;
ChangeAnimation("Ship", "Concord_Left", NO_CHANGE);
if (ThrustLeft==0)
{
ThrustLeft=1;
CreateActor("Thrust_Left", "magneto_thruster1x5_magenta_thi", "Player", "(none)", 65, 16, false);
}
break;
case 1: //Right
x+=5;
view.x+=5;
ChangeAnimation("Ship", "Concord_Right", NO_CHANGE);
//Create Thruster Anim Here
break;
}
switch(fly)
{
case 0: //None or Both
ChangeAnimation("Hover", "magneto_hover5x1_normal", NO_CHANGE);
break;
case -1: //Down
y+=3;
view.y+=3;
ChangeAnimation("Hover", "magneto_hover5x1_weak", NO_CHANGE);
break;
case 1: //Up
y-=2;
view.y-=2;
ChangeAnimation("Hover", "magneto_hover5x1_strong", NO_CHANGE);
break;
}