电源按钮创建问题的AndEngine游戏 [英] Power Button Creating Issue in AndEngine Game

查看:97
本文介绍了电源按钮创建问题的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?

推荐答案

您需要保存当前状态<一href="http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState%28android.os.Bundle%29"相对=nofollow>的onSaveInstanceState()并加载它<一个href="http://developer.android.com/reference/android/app/Activity.html#onRestoreInstanceState%28android.os.Bundle%29"相对=nofollow> onRestoreInstanceState()。

You have to save current state in onSaveInstanceState() and load it in onRestoreInstanceState().

检查此链接: Android的活动

具体做法是:

  • Activity lifecycle
  • Saving activity state

这篇关于电源按钮创建问题的AndEngine游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆