iOS gaming with cocos2dPrepared by Ngo Duc HiepCopyright 2011 PTT Solution ., JSC. All rights reserved.Hanoi, May 2011
iOS game enginescocos2dSparrowGalaxyoolong
iOS game enginesGame saladCoronaUnityiTorque
iOS game engineshttp://maniacdev.com/2011/01/open-source-and-commercial-ios-game-engine-listings-updated/http://maniacdev.com/2009/09/the-commercial-iphone-game-engine-comparison-3d-and-2d/
cocos2d gamesTap Pet Hotel: #1 FreeZombie Farm: #6 FreeTap Zoo: #2 FreeiStunt 2: #6 Free
cocos2d gamesZombieSmash: #1 PaidAir Penguin: #1 PaidTrainyard: #2 PaidFishing Frenzy: #7 Paid
cocos2d
App workflowSettingsLoadingHomeGame PlayLeaderboard
App workflowCCSceneCCDirector: run, push, pop replace scene[[CCDirectorsharedDirector] runWithScene:loading];
[[CCDirectorsharedDirector] replaceScene:home];
CCTransition: transition between scenesCCLayer
CCLayerHandle eventisTouchEnabled_
isAccelerometerEnabled_Game controllerMange game entities - CCNode
CCNodeRenderable itemCCLayer, CCScene are all nodesFeaturesContains another nodes
Schedule timer
Play actions
Position/rotation/scale/contentSizeCCSpriteSpritesTexture
CCNode: CoordinatecontentSize.widthcontentSize.height
CCNode: CoordinateanchorPointrotationposition
CCNode: Coordinate
CCNode: Transformation- (CGAffineTransform)nodeToParentTransform;- (CGAffineTransform)parentToNodeTransform;- (CGAffineTransform)nodeToWorldTransform;- (CGAffineTransform)worldToNodeTransform;- (CGPoint)convertToNodeSpace:(CGPoint)worldPoint;- (CGPoint)convertToWorldSpace:(CGPoint)nodePoint;
CCNode: ActionsModify node’s attributes by timeposition/rotation/scale/opacity/gridInterval actions and Instant actions
CCNode: ActionsCCMove_CCJump_CCBezier_CCScale_CCRotate_CCFade_
CCNode: ActionsTime alter actions:CCEase_
CCEaseExponential_
CCEaseSine_
CCEaseElastic_
CCEaseBounce_CCNode: Special actionsCCCallFuncCCCallBlockCCPropertyActionCCFollowCCSequenceCCSpawnCCRepeat
CCNode: 3D EffectsCCFlipX3D/CCFlipY3DCCWaves3DCCRipple3DCCSplitRows…
CCSprite: Animation
CCSprite: Animation
CCNode: Scheduler-(void) schedule: (SEL) s interval:(ccTime)seconds;-(void) unschedule: (SEL) s;-(void) pauseSchedulerAndActions;-(void) resumeSchedulerAndActions;
Touch DispathcherCCTouchDispathcher-(void) addStandardDelegate:(id) delegate priority:(int)priority;-(void) addTargetedDelegate:(id) delegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;-(void) removeDelegate:(id) delegate;
Box2D
FeaturesRigid bodyFixture: rectangle, circle, poligonJointContact filterContact listenerSimulate	world->Step(dt);
cocos2d  Box2DBody, joint, fixture user datafor (b2Body* b = world->GetBodyList(); b; b = b->GetNext()){	if (b->GetUserData() != NULL) {CCSprite *actor = (CCSprite*)b->GetUserData();actor.position = CGPointMake( b->GetPosition().x , b->GetPosition().y);actor.rotation = -b->GetAngle() * 180 / M_PI;	} }
CarCocos2dccCarBodyccCarWheel1ccCarWhell2Box2Db2CarBody
b2CarWheel1
b2CarWhell2
b2CarJoint1
b2CarJoint2cocos2d+ext
CCNode+extTransform- (CGAffineTransform) nodeToNodeTransform:					(CCNode *) node;- (CGAffineTransform) nodeFromNodeTransform:					(CCNode *) node;
CCNode+extTransformCollision- (CGRect) rect;
- (BOOL) isCollideWithNode:(CCNode *) node;CCNode+extTransformCollisionContaining- (BOOL) containsPoint:(CGPoint) loc;
- (BOOL) containsTouch:(UITouch *) touch;CCSprite+ext- (CCAction *) animateFramesWithKey:(NSString *) key startIndex:(int) start endIndex:(int) end duration:(float) duration reverse:(BOOL) reverse forever:(BOOL) forever;
CCComponentIndependent, portableStates controlData drivenCallbacksPhysics supportComposition
CCComponentDataTexture fileTexture def fileComponent def fileStatesChilds
CCComponentStatesAnimate framesRotate ScaleFade
CCComponentLion_jump_1.pngLion_jump_2.pngLion_jump_4.pngLion_jump_3.png

iOS Gaming with Cocos2d