什么是setTouchAreaBindingOnActionDownEnabled的目的 - AndEngine? [英] What is the purpose of setTouchAreaBindingOnActionDownEnabled - AndEngine?
问题描述
我开始与AndEngine工作,我看到一些教程使用 setTouchAreaBindingOnActionDownEnabled
,但没有解释其用途。
I am starting to work with AndEngine and I see that some tutorials use setTouchAreaBindingOnActionDownEnabled
but don't explain its purpose.
为什么我需要用 onAreaTouched
一起用这种方法?
不应该是 onAreaTouched
够了,在它的内部检测是否是向下或向上?
Why I need to use this method together with onAreaTouched
?
Should not be onAreaTouched
enough and detect inside of it whether is DOWN or UP?
感谢
推荐答案
该方法的目的 setTouchAreaBindingOnActionDownEnabled
是要能够绑定精灵/按钮/等到场景/ HUD。
The purpose of the method setTouchAreaBindingOnActionDownEnabled
is to be able to "Bind" the sprite/button/etc to a scene/hud.
例如,如果你只使用了 onAreaTouched
在一个赛车游戏的控制器。当你点击GAZ(动作下)它加速,当你松开手指(处分)减速。但是,如果你点击,并保持你的手指轻扫和(移动)按钮区域会发生什么?
在这种情况下,按钮操作起来不叫,虽然你的手指不再按钮上的车依然保持着加速。
For example, if you only use the onAreaTouched
for a controller in a race game. When you click on gaz (action down) it accelerates and when you remove your finger ( action up ) decelerates. But what happens if you click and keep your finger and swipe ( move ) outside the button area?
In this case the button action up is not called and although your finger is no longer on the button the car still keeps accelerating.
因此,代替手工管理这种情况下, setTouchAreaBindingOnActionDownEnabled
将处理这种类型的场景为你的
Thus instead of managing this scenario manually, the setTouchAreaBindingOnActionDownEnabled
will handle this type of scenario for you
来源:AE开发商
这篇关于什么是setTouchAreaBindingOnActionDownEnabled的目的 - AndEngine?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!