I made a typo, instead of
sharedDirector( ), I typed
shareDirector( ) you might want to check that part if you copy pasted the code.
Instead of putting
setTouchEnabled( ) inside the
drawLayer( ) method, put it in the
init( ) method after
drawLayer( ) has been called and add
CCDirector::sharedDirector( ) -> getTouchDelegate( ) -> addTargetedDelegate( this, 0, true ); below it.
Try putting break points inside the drawLayer method to determine where the error takes place.
Anyway, from what I’ve seen, the error is on the line
CCNode * s = getChildByTag( playerTag );. You are calling the
getChildByTag( ) method inside the
Gameplay layer and not in the
mPlayerSprite is not a child of
Gameplay layer and the app cannot find it in that layer.
An analogy: You have three drawers labeled “Garments”, “Underwear”, and “Socks”. Garments is a large drawer containing two smaller drawers, Underwear and Socks You told your kid to get a pair of socks inside the “Garments” drawer. However, there are no socks in the “”Garments" drawer and the kid will not look for the sock inside he other drawers because you told the kid to look for the sock in the “Garments” drawer. So the kid comes back saying he didn’t find it on the “Garments” drawer. Since you know where the socks are, you should tell the kid to look for the socks inside the Socks drawer instead.
Try changing it to
mPlayerSpriteLayer -> getChildyTag( playerTag ); because that’s where you added the
EDIT: Ninja’d but good for you. Always glad to help.