I have HorizontalOnScreenControl class which extends BaseOnScreenControl, it is the same as DigitalOnScreenControl, but it works only horizontal. It’s working fine. But one of this parents is Scene, and I think that why we need to do scene.setChildScene(mDigitalOnScreenControl).
Problem: when I want, for example, show popup and when I use .setChildScene() one more time, my control disappears. But if I try to add directly to main scene: scene.AttachChild(mDigitalOnScreenControl) than I can’t touch it, it’s is not working, but visible.
You should use
Camera.setHUDinstead ofScene.setChildScene.Quoting from the
HUD.javafile:If you need to add 2 or more HUDs, you can chain them this way (I have 2 HUDs in one of my games, and that’s how I do it. Works fine)
Now you can call
Scene.setChildSceneand your control won’t disappear.General knowledge: When AndEngine receives a touch event from the Android framework, the event passes through a list entities. If any of them consumes the event, it stops. The priorities are:
onSceneTouchEventmethod.Now, in your problem, when you attach the control to the scene as a regular entity, it doesn’t receive the priority it should (Controls – HUDs have a first priority). So the event was probably consumed before it even reached the control.