Skip to content Skip to sidebar Skip to footer

What Is The Purpose Of Settouchareabindingonactiondownenabled - Andengine?

I am starting to work with AndEngine and I see that some tutorials use setTouchAreaBindingOnActionDownEnabled but don't explain its purpose. Why I need to use this method together

Solution 1:

The purpose of the method setTouchAreaBindingOnActionDownEnabled is to be able to "Bind" the sprite/button/etc to a scene/hud.

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.

Thus instead of managing this scenario manually, the setTouchAreaBindingOnActionDownEnabled will handle this type of scenario for you

Source: AE developer

Post a Comment for "What Is The Purpose Of Settouchareabindingonactiondownenabled - Andengine?"