Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够暂停我的 iphone 游戏,而不仅仅是暂停它,而是基本上冻结它,除非按下继续按钮,否则只解冻它。我不能仅仅消除用户交互并停止所有动画,因为方法不断在计时器上运行。想象一下与敌人一起射击,你会如何暂停这种类型的游戏?
你的游戏中应该有一个主游戏循环,它基本上测量上次更新的时间增量,根据增量更新游戏状态并重绘。当这个循环停止旋转时,游戏就暂停了。定时器与主循环解决方案并没有真正的不同,只是暂停定时器,你就暂停了游戏。