本文介绍了电源按钮创建问题的AndEngine游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我公司开发的游戏andEngine这几乎是最后的。唯一的问题我现在面临的是,当在游戏中,如果电源按钮是pressed和游戏重新开始再次它从恒星。假设我玩6级和I pressed电源按钮时,游戏会恢复它会从1级开始任何一个可以帮助我?
I developed a game in andEngine which is almost final. Only problem I am facing now is that when during GamePlay if power button is pressed and Game is resumed again It starts from star. Suppose I am playing Level 6 and I pressed power button when the game will be resumed it will start from Level 1. Can any one help me with this?
推荐答案
您需要保存当前状态的onSaveInstanceState()并加载它 onRestoreInstanceState()。
You have to save current state in onSaveInstanceState() and load it in onRestoreInstanceState().
检查此链接: Android的活动
具体做法是:
- Activity lifecycle
- Saving activity state
这篇关于电源按钮创建问题的AndEngine游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!