XNA tempory pause
- by Marivs
I need to do a temporary pause. If I do a collision with an enemy I want to pause the game for 1.5 seconds. Take a look here to my code:
bool tPause;
float timer;
public ovveride Update(GameTime gameTime)
{
if(!tPause)
{
//...
if(enemy.rectangle.Intersects(player.rectangle))
{
timer+=(float)gameTime.ElapsedGameTime.TotalMilliseconds;
tPause=true;
if(timer>1500)
{
tPause=false;
timer=0;
}
}
//...
}
}
It doesn't function.