Using Cocos2D to create a shoot-em-up bullet hell style game. One finger drags to move the ship and there are fire layers in the corner.
From my main layer, I detect ccTouchesBegan, ccTouchesMoved and ccTouchesEnded. I pass a CGPoint into my logic controller.
If a touch down point is inside one of the 2 "fire button" layers, then I trigger a fire event. Otherwise I set a new location for the player ship. When a touch moves outside of the fire layer areas, I set a new location for the player ship.
Problem: Dragging a finger from within the fire layer into non-fire layer space causes the ship to jump to that point because of the "touch moves set player location" rule.
How can I architect this better?
Perhaps I need an array of "touch objects", and nullify them when crossing the boundary of the fire layer. I feel like I am missing some important concept about touch handling here that, if understood, would give the control I want without having to hack a "touch object" class that compares where you're tapping to an array of locations.
Please advise. Thanks!
(Yes, I saw: How do I limit touch handling to one layer when layers overlap? . That does not answer my question. The rectContainsPoint is how I determine if a touch is within or out of a fire layer).