Andengine在屏幕上暂停按钮(Andengine onScreen Pause button)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
Andengine在屏幕上暂停按钮(Andengine onScreen Pause button)

我想在引擎中创建一个屏幕上的暂停按钮

我现在做的是添加一个精灵,当我触摸它时,我做engine.stop(),这个问题是,引擎不处理更多的touchevents,直到我恢复游戏(现在我使用菜单按钮这个),那么有没有办法实现它?

谢谢!

I want to create an onscreen pause button in andengine

What I do now is add an sprite and when I touch it, I do engine.stop(), the problem with this, is that the engine doesn't handle more touchevents till I resume the game (now I use the menu button for this), so is there a way to achieve it?

Thanks!

最满意答案

看看AndEngine的例子,有一个项目显示了AndEngine中菜单的使用,你会找到一个更好的方式来实现一个菜单,而不是停止引擎。 祝你好运!

I found the best way to do it is creating an scene, and when paused, set override the onManagedUpdate this way

@Override onManagedUpdate(float pSecondsElapsed){ if(mPaused) super.onManagedUpdate(0); else super.onManagedUpdate(pSecondsElapsed); }

This way everything works perfectly, and you can do it on a game layer and have the menu layer updated as usual,

更多推荐

本文发布于:2023-04-12 20:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/a5ac362c2abd6841564b95172b9e87a5.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   屏幕上   Andengine   button   Pause

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!