My recommendation would be to create a HUDLayer, so everything I write now will have this in mind.
HUDLayer will be CCLayer
, which is on top of others, and is fixed on the screen. To be on top, you need to add it last or with the corresponding zOrder.
In this layer, you must map the ccTouchesBegan event and just work with users. For example, a character may jump when the user lands on the right side of the screen. To do this, just see if there is a CGRectContainsPoint(rightSideOfScreen, touchLocation)
, and if so, take a character jump and show buttonSprite on touchLocation.
To hide the sprite, use ccTouchesEnded, so when the player releases the transition button, you can also hide the sprite.
source share