我正在 xna 编程一个点球大战,我的问题是我如何只计算 1 个进球,然后让时间获得进球信息??,
我已经解决了守门员,球门和球门区之间的冲突,我保持并得分但是当球触及球门区时,当球触及球门区时得分总是增加,我怎么算1个进球然后显示目标信息??
这是我到目前为止所拥有的,我考虑延迟但它不起作用,请帮助我陷入困境
if (_gameState == GameState.Playing)
{
if (CollideGoalArea())
{
if (CollideGoalKeeper())
{
_messageToDisplay = "Goalie defends the goal!";
this.Window.Title = "Missed!";
_gameState = GameState.Message;
}
else
{
score++;
_messageToDisplay = "GOAL!";
this.Window.Title = "Goal!";
_gameState = GameState.Message;
}
}
else
{
_messageToDisplay = "You missed the goal.";
_gameState = GameState.Message;
}
}
else if (_gameState == GameState.Message)
{
if (Mouse.GetState().RightButton == ButtonState.Pressed)
{ // right click to continue playing
_gameState = GameState.Playing;
balonpos.X = 300;
balonpos.Y = 350;
}
}