Making a player shoot....
Posted: Mon Jan 12, 2009 10:05 pm
How can you make it so, that when you push a certain button, it will shoot... I don't want it to stay, I want it to move the direction the player shoots...
if (direction==1) // right
{
xvelocity=5;
}
if (direction==-1) // left
{
xvelocity=-5;
}
// Add the directions as necassary
xvelocity=direction*5;
int i;
for (i=1; i<=powerlevel; i++){ //when powerlevel is 0, this loop will do nothing.
//20 is the angle offset for each
//new shot in the spread.
myangle=(i*20); //sets bullet angle above
CreateActor("bullet", "bullet", "no parent", "no path", 0, 0, false);
myangle=-(i*20); //sets bullet angle below
CreateActor("bullet", "bullet", "no parent", "no path", 0, 0, false);
}
//Here's the main shot (0 degrees) which still happens if powerlevel is 0.
CreateActor("bullet", "bullet", "no parent", "no path", 0, 0, false);