Hi,
I read it : http://www.cocos2d-iphone.org/wiki/doku.php/tips:using_accelerometer_for_sprite_movement
But I do not understand those lines :
// use the running scene to grab the appropriate game layer by it's tag
GameLayer *layer = (GameLayer *)[[[CCDirector sharedDirector] runningScene] getChildByTag:kTagGameLayer];
// grab the player sprite from that layer using it's tag
CCSprite *playerSprite = (CCSprite *)[layer getChildByTag:kTagSpritePlayer];
- What is GameLayer ?
- What do I write there : (GameLayer *) and there : (CCSprite *) .
Thanks.
EDIT : I made severales tries, this on looks to be the best :
// use the running scene to grab the appropriate game layer by it's tag
HelloWorld *layer = [HelloWorld [[CCDirector sharedDirector] runningScene] getChildByTag:kTagGameLayer];
// grab the player sprite from that layer using it's tag
CCSprite *playerSprite = [killer[layer getChildByTag:kTagSpritePlayer]];
HelloWorld is declared in the .h @interface HelloWorld : CCLayer {...} , and killer is the sprite whcich I want to make move.