want to add the missile that will goes from the bottom of the space ship when I pressed space bar. Below is my code, I call the method from the Update() method, I'm not sure what's wrong with my code, it doesn't work, I tried it before within the HandleInput() method, but still doesn't work either... Please help.. Thanx
PHP Code:
public void CheckInput()
{
KeyboardState state = Keyboard.GetState();
Keys[] keys = state.GetPressedKeys();
const float laserSpeed = 10;
for (int i = 0; i < keys.Length; i++)
{
if (keys[i] == Keys.Space)
{
while (laserPosition.Z >= 3500)
{
laserPosition.Z -= laserSpeed;
}
}
}
}
Does anybody have ideas? The missile is 3 dimensional that is drawn right before I draw the spaceship, I use laserPosition that follows the spaceshipPosition so that it will always be under the spaceship at all time, and must be shot from there and move forward (up). This code doesn't make the missile do anything, it just stays on the spaceship.. thx