I have a simple game that I’m testing and I’m having a problem with my touch event. It’s a side-scroller game that has a ship that fires bullets at enemies. So I have a background image and I’ve added a fire button graphic. When I press the fire button, I’d like my ship to fire a bullet, but when I press anywhere else on the screen, I’d like to just move the ship upwards. The problem I’m having is that when I touch the fire button it does fire a bullet, but it also moves the ship upwards, which I don’t want. When I touch the screen without touching the fire button it does behave correctly by just moving the ship upwards.
I have a runtime listener on the touch event, and a regular event listener on the fire button. Am I suppose to test what part of the screen was touched? I can’t seem to get this working properly. Please advise.