【发布时间】:2014-06-09 07:29:24
【问题描述】:
我需要暂停一下。如果我与敌人发生碰撞,我想暂停游戏 1.5 秒。看看我的代码:
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;
}
}
//...
}
}
它不起作用!我可以修改什么?
【问题讨论】: