private void ControllerManager(GamePadState aControllerState, ref PlayerShip aShip, GameTime gameTime)
{
// check for input from a player
// left and right
if (aControllerState.ThumbSticks.Left.X > 0 || aControllerState.DPad.Right > 0)
{
aSlime.IncrimentalMove(new Vector3(GameParameters.movementSpeed, 0.0f, 0.0f));
}
else if (aControllerState.ThumbSticks.Left.X < 0 || aControllerState.DPad.Left > 0)
{
aSlime.IncrimentalMove(new Vector3(-GameParameters.movementSpeed, 0.0f, 0.0f));
}
if (aControllerState.Buttons.A == ButtonState.Pressed)
{
if (aSlime.Position.Y < (GameParameters.bottomBound + 1.0f))
{
aSlime.AddVelocity(GameParameters.slimesJumpingVelocity);
}
}
if (aControllerState.Buttons.B == ButtonState.Pressed &&
aSlime.Position.Y > (GameParameters.bottomBound + 1.0f))
{
float currentGameTime = (float)gameTime.TotalGameTime.TotalMilliseconds;
if (aSlime.LastTimeIShot + 500.0f < currentGameTime)
{
// create a simgle slime bullet
Laser aSingleBullet = new Laser();
aSingleBullet.ThreeDModelFile = Content.Load<Model>("Models/SlimeManNum1");
aSingleBullet.ScaleValue = 0.4f;
aSingleBullet.Velocity = new Vector3(20.0f, 0.0f, 0.0f);
aSingleBullet.Position = greenSlime.Position;
// add the 1 bullet to the list
greenSlimeBullet.Add(aSingleBullet);
aSlime.LastTimeIShot = (float)gameTime.TotalGameTime.TotalMilliseconds;
}
}
}
Thanks.

New Topic/Question
Reply



MultiQuote




|