So I've created an Arkanoid Paddle which basically moves left and right with the analog stick.
if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X == -1.0f)
{
// Player one has pressed the left thumbstick up.
Position.X = Position.X - (5 + speedup1);
}
if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Left.X == 1.0f)
{
// Player one has pressed the left thumbstick up.
Position.X = Position.X + (5 + speedup1);
}
speedup1
is an initial integer value set at zero and when the Player
presses the Right Trigger, it sets the value to 5, thus increasing the speed of the paddle.
if (GamePad.GetState(PlayerIndex.One).Triggers.Right > 0)
{
speedup1 = 5;
}
What I want to do is make it so that after pressing the trigger, the value of speedup1
returns to 0 after a set interval of time and the player is not able to change it again for another set interval of time.
Help, please,