Monthly Archives: April 2011

Cocos2d Notes (1)

1. Never replace scene with self: [[CCDirector sharedDirector] replaceScene:self]. This will freeze the game.

2. Never retain child node in scene graph for self reference. Let cocos2d do the memory management.

3. Watch your memory usage while doing scene transition. That’s the critical point for large memory usage.

4. Use push and pop scene carefully. Push scene will not release the memory used by the scene, but it will be fast if you want to display the scene later. It is useful if you need to display the “Setting” scene. You can push it to stack and when player close the setting scene, you can pop to display the last displayed scene.

5. Use short scene transition or no transition.

6. One scene can have any number layers, but you should have only 1 layer receiving touch and accelerometer events.

7. Targeted touch receives only 1 touch at a time. It separates cocoa touches into different touch event.

8. File name is sensitive in iOS devices but not in simulator!!!

9. Once an action finishes its task, it will remove itself from node automatically.

Leave a comment

Posted by on April 1, 2011 in Cocos2d, iPhone


Tags: ,