SlideShare a Scribd company logo
iOS Game Development
with Cocos2D
Yaron Karasik
yaronkarasik@gmail.com @Greenwell
Thursday, June 21, 12
iOS Game Development
with Cocos2D
Part 1: Why Cocos2D?
Part 2: Cocos2D Basics
Part 3: Let’s build a Cocos2D game
Thursday, June 21, 12
Part 1:
Why Cocos2D?
Thursday, June 21, 12
Meet Cocos2D for iPhone
★ Open source iOS game development framework
★ Developed by Ricardo Quesada, acqui-hired by
Zynga (2011)
★ Stable v1.1 Based on OpenGL ES 1.1
★ Beta v2.0 Based on OpenGL ES 2.0
★ 3,500+ iOS games shipped
Thursday, June 21, 12
The Cocos2D Family
Cocos2d-Android
(Java)
Cocos2d-X
iPhone/Android (C++)
Cocos2d-Mac
(Obj-C)
Cocos2d-XNA
Windows Phone 7 (C#)
Cocos2d-HTML5
Web (Javascript)
Cocos3D
(Obj-C)
Thursday, June 21, 12
Proven Success
Thursday, June 21, 12
Great Effort-Flexibility Balance
0
100
Effort
Flexibility
Cocos2D/Sparrow
Unity/Corona
Direct OpenGL/
CoreGraphics
Thursday, June 21, 12
Cross Device, Cross Resolution
Thursday, June 21, 12
Active Ecosystem
Thursday, June 21, 12
And most importantly..
Tons of great features for games
SceneTransitionsSprite Sheets
Effects:
Lense, Ripple,Wave..
Actions:
Move, Rotate, Scale..
Integrated Physics Engines
Sound Support
Tile Map Support
Text RenderingParticle Systems
Parallax Scrolling
Shaders (v2.0)Ribbons
Thursday, June 21, 12
Part 2:
Cocos2D Basics
Thursday, June 21, 12
Basic Cocos2D Concepts
Director
Thursday, June 21, 12
Basic Cocos2D Concepts
Director
Scenes
Thursday, June 21, 12
Basic Cocos2D Concepts
Director
Scenes
Layers
Thursday, June 21, 12
Basic Cocos2D Concepts
Director
Scenes
Layers
Sprites
Thursday, June 21, 12
Director & Scenes
Intro Main Menu Level I Level 2 Victory
Options
High Scores
LossDirector
★ Game made up of “game screens” called Scenes
★ Each Scene can be considered a separate app
★ Director handles main window and executes Scenes
Thursday, June 21, 12
Layers
★ Each Scene contains several full screen Layers
★ Layers contain Sprites which are the game elements
★ Layers useful for Controls, Background, Labels, Menus.
Thursday, June 21, 12
Nodes
Nodes are anything that gets drawn or contains
things that get drawn (= Scene, Layer, Sprite)
Can: ★ Contain other Nodes
★ Schedule periodic callbacks
★ Execute Actions
Thursday, June 21, 12
Sprites in Action
Create
CCSpriteFrame* spriteFrame = [[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:@"sprite.png"];
CCSprite* sprite = [CCSprite spriteWithSpriteFrame:spriteFrame];
Thursday, June 21, 12
Sprites in Action
Add to Layer
sprite.position = ccp(x, y);
[layer addChild:sprite z:5 tag:666];
(0,0)
winSize.height
winSize.width
(x,y) at anchor point
Thursday, June 21, 12
Sprites in Action
Move
CCMoveTo *moveToAction = [CCMoveTo actionWithDuration:duration
position:newPosition];
[sprite runAction:moveToAction];
Properties can be transformed directly or through actions
Thursday, June 21, 12
Sprites in Action
Scale/Rotate
CCScaleTo *scaleToAction = [CCScaleTo actionWithDuration:duration scale:scale];
CCRotateBy *rotateByAction = [CCRotateBy actionWithDuration:duration angle:angle];
CCSequence *sequence = [CCSequence actions:scaleToAction, rotateByAction, nil];
[sprite runAction:sequence];
Thursday, June 21, 12
Sprites in Action
Animate
CCAnimation* animation = [[CCAnimationCache sharedAnimationCache]
animationByName:@"animation"];
CCAnimate* animateAction = [CCAnimate actionWithAnimation:animation];
[sprite runAction:animateAction];
Thursday, June 21, 12
Sprites in Action
Schedule Updates
[scene schedule:@selector(updateSprite:) interval:interval];
Thursday, June 21, 12
Actions
Can be performed on Sprites or any Node
Basic Move, Scale, Rotate, Bezier, Hide, Fade,Tint..
Composition Sequence, Repeat, Spawn, RepeatForever..
Ease Ease, EaseExponential, EaseBounce..
Effects Lens, Liquid, Ripple, Shaky,Twirl,Waves..
Special CallFunc, Follow..
Thursday, June 21, 12
Spritesheets
★ Added as a child to the layer
★ Created withTexturePacker or Zwoptex
★ Memory considerations, 16bit images, .pvr.ccz
Thursday, June 21, 12
Controls
★ Implement directly based on CCStandardTouchDelegate
★ Can use UIGestureRecognizer classes
★ Open source implementations of joypad/buttons available
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
Thursday, June 21, 12
Let’s Make a Game!
Part 3:
Thursday, June 21, 12
Let’s Make a Game!
..but first we need a story, graphics, music and sfx :)
Part 3:
Thursday, June 21, 12
Because he likes to kill paratroopers
Para-Shoot
Thursday, June 21, 12
Graphics
Benjamin Radchek Sprites by The_Protoganist and _Allen_
http://www.freewebs.com/teh_pro/sprites.htm
Thursday, June 21, 12
Music & SFX
Explosive Attack by McTricky @ Sakari Infinity
http://www.sakari-infinity.net/author/McTricky
Background music, shoot sound, death sound
Thursday, June 21, 12
Music & SFX
Explosive Attack by McTricky @ Sakari Infinity
http://www.sakari-infinity.net/author/McTricky
Background music, shoot sound, death sound
Thursday, June 21, 12
Sneak Peek
Thursday, June 21, 12
Steps for making Para-Shoot
Application Setup
Step 1: Adding Background
Step 2: Adding Our Hero
Step 3: Adding Bad Guys (Game Logic)
Step 4: Killing Bad Guys (Adding UI)
Step 5: Check for Bad Guy Death
Step 6: Animating Our Hero
Step 7: Animating Bad Guys Dying
Step 8: Adding Body Count
Step 9: Adding Sound & Music
Thursday, June 21, 12
New Cocos2D Project
Thursday, June 21, 12
@interface HelloWorldLayer : CCLayer
{
! // Player sprite
! CCSprite *_player;
// Target and bullet sprite arrays
! NSMutableArray *_targets;
NSMutableArray *_bullets;
! // Body count counter and isShooting flag
int _bodyCount;
BOOL _isShooting;
!
! // For body count label
! CCLabelTTF *_labelTitle;
! CCLabelTTF *_labelCount;
}
HelloWorldScene.h
Thursday, June 21, 12
HelloWorldScene.m
// Create the new scene including this layer
+(id) scene
{
! // Create the scene
! CCScene *scene = [CCScene node];
!
! // Create the layer
! HelloWorldLayer *layer = [HelloWorldLayer node];
!
! // add layer as a child to scene
! [scene addChild: layer];
!
! // return the scene
! return scene;
}
Thursday, June 21, 12
Hello World
Thursday, June 21, 12
Step 1:Adding Background
(In init)
// Get the window size to place elements
CGSize winSize = [[CCDirector sharedDirector] winSize];
// Add the background image
CCSprite *background = [CCSprite spriteWithFile:@"background.png"];
background.position = ccp(winSize.width/2, winSize.height/2);
[self addChild:background z:0];
Thursday, June 21, 12
Step 1:Adding Background
Thursday, June 21, 12
Step 2:Adding Our Hero
(In init)
// Load the sprite sheet
CCSpriteBatchNode *batchNode = [CCSpriteBatchNode
batchNodeWithFile:@"parashoot.pvr.ccz"];
[self addChild:batchNode];
// Load the sprites into the shareSpriteFrameCache
[[CCSpriteFrameCache sharedSpriteFrameCache]
addSpriteFramesWithFile:@"parashoot.plist"];
Preload the spritesheet
Thursday, June 21, 12
Step 2:Adding Our Hero
// Add the player sprite
CCSpriteFrame* playerFrame = [[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:@"player_01.png"];
_player = [CCSprite spriteWithSpriteFrame:playerFrame];
_player.position = ccp(_player.contentSize.width/2 + 10, winSize.height/2);
[self addChild:_player z:1];
Add the hero sprite
Thursday, June 21, 12
Step 2:Adding Our Hero
Thursday, June 21, 12
Step 3:Adding Bad Guys (Game Logic)
(in init)
[self schedule:@selector(addTarget:) interval:1.0f];
Schedule a new target every second
Thursday, June 21, 12
// Create a new enemy
-(void)addTarget:(ccTime)dt {
// Create the target sprite
CCSpriteFrame *targetFrame = [[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:@"target.png"];
!CCSprite *target = [CCSprite spriteWithSpriteFrame:targetFrame];
// Add the target to the layer and the array
! [self addChild:target];
! [_targets addObject:target];
Step 3:Adding Bad Guys (Game Logic)
Create a sprite for the target
Thursday, June 21, 12
Step 3:Adding Bad Guys (Game Logic)
! // Determine where to spawn the target along the X axis
! CGSize winSize = [[CCDirector sharedDirector] winSize];
// Find a random X for the target in the right half of the screen
! int minX = winSize.width/2;
! int maxX = winSize.width - target.contentSize.width;
! int rangeX = maxX - minX;
! int actualX = (arc4random() % rangeX) + minX;
target.position = ccp(actualX, 320);
target.anchorPoint = ccp(0, 0);
! // Determine speed of the target
! int minDuration = 2.0;
! int maxDuration = 4.0;
! int rangeDuration = maxDuration - minDuration;
! int actualDuration = (arc4random() % rangeDuration) + minDuration;
Generate a random x position for the target
Thursday, June 21, 12
Step 3:Adding Bad Guys (Game Logic)
// Create and run the actions
CCMoveTo* moveTarget = [CCMoveTo actionWithDuration:actualDuration
! ! ! position:ccp(actualX, -target.contentSize.height/2)];
CCCallFuncN* actionForTargetMoveDidFinish = [CCCallFuncN
actionWithTarget:self selector:@selector(targetMoveFinished:)];
[target runAction:[CCSequence actions:moveTarget, actionForTargetMoveDidFinish, nil]];
Create a move action for the target with a
callback when reaching the bottom
Thursday, June 21, 12
Step 3:Adding Bad Guys (Game Logic)
// Method for removing a target that has died or reached the
bottom
-(void)targetMoveFinished:(id)sender {
! CCSprite *target = (CCSprite *)sender;
[self removeChild:target cleanup:YES];
! [_targets removeObject:target];
}
Add the callback method for a target that
dies or reaches the bottom
Thursday, June 21, 12
Step 3:Adding Bad Guys (Game Logic)
Thursday, June 21, 12
Step 4: Killing Bad Guys (Adding UI)
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
! // Choose one of the touches to work with
! UITouch *touch = [touches anyObject];
! CGPoint location = [touch locationInView:[touch view]];
! location = [[CCDirector sharedDirector] convertToGL:location];
!
if (!_isShooting) {
_isShooting = YES;
Detect the touch
Thursday, June 21, 12
Step 4: Killing Bad Guys (Adding UI)
// Create the bullet
CCSpriteFrame* bulletFrame = [[CCSpriteFrameCache sharedSpriteFrameCache]
spriteFrameByName:@"bullet.png"];
CCSprite* bulletSprite = [CCSprite spriteWithSpriteFrame:bulletFrame];
bulletSprite.position = _player.position;
// Bullet actions
CCCallFuncN* actionForRemoveBullet = [CCCallFuncN actionWithTarget:self
selector:@selector(removeBullet:)];
CCMoveBy* bulletMoveBy = [CCMoveBy actionWithDuration:1.0f
position:ccp(winSize.width, 0)];
[bulletSprite runAction:[CCSequence actionOne:bulletMoveBy
two:actionForRemoveBullet]];
// Add bullet to layer and array
[self addChild:bulletSprite];
[_bullets addObject:bulletSprite];
Create the bullet
Thursday, June 21, 12
Step 4: Killing Bad Guys (Adding UI)
Thursday, June 21, 12
Step 5: Check for Bad Guy Death
-(void)update:(ccTime)dt {
CCSprite* bulletToRemove = nil;
for (CCSprite *bullet in _bullets) {
for (CCSprite* target in _targets) {
CGRect targetBox = CGRectMake(target.position.x, target.position.y,
[target boundingBox].size.width, [target boundingBox].size.height);
// Check if bullet is in the target's bounding box
if (CGRectContainsPoint(targetBox, bullet.position)) {
// Animate target death and remove target
bulletToRemove = bullet;
}
}
}
// Remove bullet if target was hit
if (bulletToRemove != nil) {
[self removeChild:bulletToRemove cleanup:YES];
[_bullets removeObject:bulletToRemove];
}
}
Thursday, June 21, 12
Step 5: Check for Bad Guy Death
Thursday, June 21, 12
Step 6:Animating Our Hero
(In init)
// Load the animation for player
NSMutableArray *animFrames1 = [NSMutableArray array];
for (int i = 1; i < 12; i++) {
CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"player_%02d.png",i]];
! [animFrames1 addObject:frame];
}
[[CCAnimationCache sharedAnimationCache] addAnimation:[CCAnimation
animationWithFrames:animFrames1 delay:FRAME_DELAY] name:@"player"];!
Preload the animation from the spritesheet
Thursday, June 21, 12
Step 6:Animating Our Hero
(In ccTouchesEnded)
// Actions for shooting animation
CCCallFunc* actionForShootDidEnd = [CCCallFunc actionWithTarget:self
selector:@selector(shootDidEnd)];
CCAnimation* playerShootAnimation = [[CCAnimationCache sharedAnimationCache]
animationByName:@"player"];
CCAnimate* shootAnimate = [CCAnimate actionWithAnimation:playerShootAnimation];
[_player runAction:[CCSequence actionOne:shootAnimate two:actionForShootDidEnd]];
Animate the hero when shooting
Thursday, June 21, 12
Step 6:Animating Our Hero
Thursday, June 21, 12
Step 7:Animating Bad Guys Dying
(in update)
// Set up actions for animation and target removal
CCCallFuncN* actionForDeathDidFinish = [CCCallFuncN actionWithTarget:self
selector:@selector(targetMoveFinished:)];
CCAnimate* deathAnimation = [CCAnimate actionWithAnimation:[[CCAnimationCache
sharedAnimationCache] animationByName:@"death"] restoreOriginalFrame:NO];
[target runAction:[CCSequence actionOne:deathAnimation two:actionForDeathDidFinish]];
Thursday, June 21, 12
Step 7:Animating Bad Guys Dying
Thursday, June 21, 12
Step 8:Adding Body Count
(In init)
NSString* bodyCountString = [NSString stringWithFormat:@"%d", _bodyCount];
_labelCount = [CCLabelTTF labelWithString:bodyCountString fontName:@"Arial"
fontSize:16];
_labelCount.color = ccc3(0,0,0);
_labelCount.position = ccp(110, winSize.height - 16);
[self addChild:_labelCount z:2];
(In ccTouchesEnded)
_bodyCount++;
NSString* bodyCountString = [NSString stringWithFormat:@"%d", _bodyCount];!
[_labelCount setString:bodyCountString];
Thursday, June 21, 12
Step 8:Adding Body Count
Thursday, June 21, 12
Step 9:Adding Sound & Music
(In init)
! // Start background music, set lower volume
! SimpleAudioEngine.sharedEngine.backgroundMusicVolume = 0.4f;
! [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"explosive_attack.mp3"];
(In ccTouchesEnded)
! // Play sound effect on every shot and on death
! [[SimpleAudioEngine sharedEngine] playEffect:@"shot.wav"];
! [[SimpleAudioEngine sharedEngine] playEffect:@"death.wav"];
Thursday, June 21, 12
Step 9:Adding Sound & Music
Thursday, June 21, 12
Let’s Play!
Thursday, June 21, 12
Para-Shoot 2.0
Enemies can move and attack
Joypad + HUD
Move our hero
Different weapons, power ups and health
Game menu and high scores
Levels
Save/Load Game
Refactor code (More scenes and layers)
Thursday, June 21, 12
Refactoring Para-Shoot
Intro Main Menu Level X Victory
Options
High Score
Loss
Level X Background Player Bad Guys Joypad/HUD
Scenes:
Layers:
Thursday, June 21, 12
More stuff to explore
★ Physics Engines - Chipmunk and Box2D
★ Particle System
★ Tilemaps
★ Menu Interface
Thursday, June 21, 12
Where can you learn more
Cocos2D Demo Library (Comes with Cocos)
Wiki: http://cocos2d-iphone.org/wiki
Ray Wenderlich: http://www.raywenderlich.com
Steffen Itterheim: http://learn-cocos2d.com
SapusTongue Source Code: http://www.sapusmedia.com/sources
Thursday, June 21, 12
ThankYou!
Yaron Karasik
yaronkarasik@gmail.com
@Greenwell
Thursday, June 21, 12

More Related Content

What's hot

Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
British Council
 
WP7 HUB_XNA
WP7 HUB_XNAWP7 HUB_XNA
WP7 HUB_XNA
MICTT Palma
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.
UA Mobile
 
06 html5 and cocos2d-x
06   html5 and cocos2d-x06   html5 and cocos2d-x
06 html5 and cocos2d-x
乐费 胡
 
The Ring programming language version 1.7 book - Part 64 of 196
The Ring programming language version 1.7 book - Part 64 of 196The Ring programming language version 1.7 book - Part 64 of 196
The Ring programming language version 1.7 book - Part 64 of 196
Mahmoud Samir Fayed
 
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Grant Goodale
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
Jenchoke Tachagomain
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
Jenchoke Tachagomain
 
Windows Azure Storage
Windows Azure StorageWindows Azure Storage
Windows Azure Storage
goodfriday
 
Game age ppt
Game age pptGame age ppt
Game age ppt
Ahmed Yousef
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話
Kohki Miki
 
Scrollytelling
ScrollytellingScrollytelling
Scrollytelling
Baron Watts
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
MICTT Palma
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5
Mark Chang
 
Hive sql的编译过程
Hive sql的编译过程Hive sql的编译过程
Hive sql的编译过程
Chen Chun
 

What's hot (15)

Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
 
WP7 HUB_XNA
WP7 HUB_XNAWP7 HUB_XNA
WP7 HUB_XNA
 
Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.Gems of GameplayKit. UA Mobile 2017.
Gems of GameplayKit. UA Mobile 2017.
 
06 html5 and cocos2d-x
06   html5 and cocos2d-x06   html5 and cocos2d-x
06 html5 and cocos2d-x
 
The Ring programming language version 1.7 book - Part 64 of 196
The Ring programming language version 1.7 book - Part 64 of 196The Ring programming language version 1.7 book - Part 64 of 196
The Ring programming language version 1.7 book - Part 64 of 196
 
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
Mapping Flatland: Using MongoDB for an MMO Crossword Game (GDC Online 2011)
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
 
Windows Azure Storage
Windows Azure StorageWindows Azure Storage
Windows Azure Storage
 
Game age ppt
Game age pptGame age ppt
Game age ppt
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話
 
Scrollytelling
ScrollytellingScrollytelling
Scrollytelling
 
WP7 HUB_XNA overview
WP7 HUB_XNA overviewWP7 HUB_XNA overview
WP7 HUB_XNA overview
 
Computational Linguistics week 5
Computational Linguistics  week 5Computational Linguistics  week 5
Computational Linguistics week 5
 
Hive sql的编译过程
Hive sql的编译过程Hive sql的编译过程
Hive sql的编译过程
 

Similar to Basics cocos2d

Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
Vinsol
 
iOS Game Development with Cocos2D
iOS Game Development with Cocos2DiOS Game Development with Cocos2D
iOS Game Development with Cocos2D
Greenwell
 
Unity workshop
Unity workshopUnity workshop
Unity workshop
fsxflyer789Productio
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
Changwon National University
 
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
Tomomi Imura
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
Jussi Pohjolainen
 
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
SICEF
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
tutorialsruby
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
corehard_by
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
Susan Gold
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
noorcon
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
enrique_arguello
 
Get Into Sprite Kit
Get Into Sprite KitGet Into Sprite Kit
Get Into Sprite Kit
waynehartman
 
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Applitools
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
Platty Soft
 
Game development via_sprite_kit
Game development via_sprite_kitGame development via_sprite_kit
Game development via_sprite_kit
Buşra Deniz, CSM
 
Creating physics game in 1 hour
Creating physics game in 1 hourCreating physics game in 1 hour
Creating physics game in 1 hour
Linkou Bian
 
Cocos2d for beginners
Cocos2d for beginnersCocos2d for beginners
Cocos2d for beginners
Azukisoft Pte Ltd
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
Nick Pruehs
 

Similar to Basics cocos2d (20)

Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
 
iOS Game Development with Cocos2D
iOS Game Development with Cocos2DiOS Game Development with Cocos2D
iOS Game Development with Cocos2D
 
Unity workshop
Unity workshopUnity workshop
Unity workshop
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
 
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
[JS Kongress 2016] KittyCam.js - Raspberry Pi Camera w/ Cat Facial Detection
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
Webelinx - iOS development: earn 100k daily with 1h of coding #tnt3
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 6 (Preview)
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
Get Into Sprite Kit
Get Into Sprite KitGet Into Sprite Kit
Get Into Sprite Kit
 
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
 
Game development via_sprite_kit
Game development via_sprite_kitGame development via_sprite_kit
Game development via_sprite_kit
 
Creating physics game in 1 hour
Creating physics game in 1 hourCreating physics game in 1 hour
Creating physics game in 1 hour
 
Cocos2d for beginners
Cocos2d for beginnersCocos2d for beginners
Cocos2d for beginners
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 

More from sagaroceanic11

Module 21 investigative reports
Module 21 investigative reportsModule 21 investigative reports
Module 21 investigative reports
sagaroceanic11
 
Module 20 mobile forensics
Module 20 mobile forensicsModule 20 mobile forensics
Module 20 mobile forensics
sagaroceanic11
 
Module 19 tracking emails and investigating email crimes
Module 19 tracking emails and investigating email crimesModule 19 tracking emails and investigating email crimes
Module 19 tracking emails and investigating email crimes
sagaroceanic11
 
Module 18 investigating web attacks
Module 18 investigating web attacksModule 18 investigating web attacks
Module 18 investigating web attacks
sagaroceanic11
 
Module 17 investigating wireless attacks
Module 17 investigating wireless attacksModule 17 investigating wireless attacks
Module 17 investigating wireless attacks
sagaroceanic11
 
Module 04 digital evidence
Module 04 digital evidenceModule 04 digital evidence
Module 04 digital evidence
sagaroceanic11
 
Module 03 searching and seizing computers
Module 03 searching and seizing computersModule 03 searching and seizing computers
Module 03 searching and seizing computers
sagaroceanic11
 
Module 01 computer forensics in todays world
Module 01 computer forensics in todays worldModule 01 computer forensics in todays world
Module 01 computer forensics in todays world
sagaroceanic11
 
Virtualisation with v mware
Virtualisation with v mwareVirtualisation with v mware
Virtualisation with v mware
sagaroceanic11
 
Virtualisation overview
Virtualisation overviewVirtualisation overview
Virtualisation overview
sagaroceanic11
 
Virtualisation basics
Virtualisation basicsVirtualisation basics
Virtualisation basics
sagaroceanic11
 
Introduction to virtualisation
Introduction to virtualisationIntroduction to virtualisation
Introduction to virtualisation
sagaroceanic11
 
6 service operation
6 service operation6 service operation
6 service operation
sagaroceanic11
 
5 service transition
5 service transition5 service transition
5 service transition
sagaroceanic11
 
4 service design
4 service design4 service design
4 service design
sagaroceanic11
 
3 service strategy
3 service strategy3 service strategy
3 service strategy
sagaroceanic11
 
2 the service lifecycle
2 the service lifecycle2 the service lifecycle
2 the service lifecycle
sagaroceanic11
 
1 introduction to itil v[1].3
1 introduction to itil v[1].31 introduction to itil v[1].3
1 introduction to itil v[1].3
sagaroceanic11
 
Visual studio 2008 overview
Visual studio 2008 overviewVisual studio 2008 overview
Visual studio 2008 overview
sagaroceanic11
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
sagaroceanic11
 

More from sagaroceanic11 (20)

Module 21 investigative reports
Module 21 investigative reportsModule 21 investigative reports
Module 21 investigative reports
 
Module 20 mobile forensics
Module 20 mobile forensicsModule 20 mobile forensics
Module 20 mobile forensics
 
Module 19 tracking emails and investigating email crimes
Module 19 tracking emails and investigating email crimesModule 19 tracking emails and investigating email crimes
Module 19 tracking emails and investigating email crimes
 
Module 18 investigating web attacks
Module 18 investigating web attacksModule 18 investigating web attacks
Module 18 investigating web attacks
 
Module 17 investigating wireless attacks
Module 17 investigating wireless attacksModule 17 investigating wireless attacks
Module 17 investigating wireless attacks
 
Module 04 digital evidence
Module 04 digital evidenceModule 04 digital evidence
Module 04 digital evidence
 
Module 03 searching and seizing computers
Module 03 searching and seizing computersModule 03 searching and seizing computers
Module 03 searching and seizing computers
 
Module 01 computer forensics in todays world
Module 01 computer forensics in todays worldModule 01 computer forensics in todays world
Module 01 computer forensics in todays world
 
Virtualisation with v mware
Virtualisation with v mwareVirtualisation with v mware
Virtualisation with v mware
 
Virtualisation overview
Virtualisation overviewVirtualisation overview
Virtualisation overview
 
Virtualisation basics
Virtualisation basicsVirtualisation basics
Virtualisation basics
 
Introduction to virtualisation
Introduction to virtualisationIntroduction to virtualisation
Introduction to virtualisation
 
6 service operation
6 service operation6 service operation
6 service operation
 
5 service transition
5 service transition5 service transition
5 service transition
 
4 service design
4 service design4 service design
4 service design
 
3 service strategy
3 service strategy3 service strategy
3 service strategy
 
2 the service lifecycle
2 the service lifecycle2 the service lifecycle
2 the service lifecycle
 
1 introduction to itil v[1].3
1 introduction to itil v[1].31 introduction to itil v[1].3
1 introduction to itil v[1].3
 
Visual studio 2008 overview
Visual studio 2008 overviewVisual studio 2008 overview
Visual studio 2008 overview
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 

Recently uploaded

Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
BrainSell Technologies
 
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptxDublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Kunal Gupta
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
sunilverma7884
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
WhatsApp Spy Online Trackers and Monitoring Apps
WhatsApp Spy Online Trackers and Monitoring AppsWhatsApp Spy Online Trackers and Monitoring Apps
WhatsApp Spy Online Trackers and Monitoring Apps
HackersList
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
Safe Software
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Zilliz
 
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
aslasdfmkhan4750
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
313mohammedarshad
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
bhumivarma35300
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
aakash malhotra
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
digitalxplive
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
maigasapphire
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
ssuser1915fe1
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 

Recently uploaded (20)

Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
 
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptxDublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
WhatsApp Spy Online Trackers and Monitoring Apps
WhatsApp Spy Online Trackers and Monitoring AppsWhatsApp Spy Online Trackers and Monitoring Apps
WhatsApp Spy Online Trackers and Monitoring Apps
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
 
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptxIntroduction-to-the-IAM-Platform-Implementation-Plan.pptx
Introduction-to-the-IAM-Platform-Implementation-Plan.pptx
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 

Basics cocos2d

  • 1. iOS Game Development with Cocos2D Yaron Karasik yaronkarasik@gmail.com @Greenwell Thursday, June 21, 12
  • 2. iOS Game Development with Cocos2D Part 1: Why Cocos2D? Part 2: Cocos2D Basics Part 3: Let’s build a Cocos2D game Thursday, June 21, 12
  • 4. Meet Cocos2D for iPhone ★ Open source iOS game development framework ★ Developed by Ricardo Quesada, acqui-hired by Zynga (2011) ★ Stable v1.1 Based on OpenGL ES 1.1 ★ Beta v2.0 Based on OpenGL ES 2.0 ★ 3,500+ iOS games shipped Thursday, June 21, 12
  • 5. The Cocos2D Family Cocos2d-Android (Java) Cocos2d-X iPhone/Android (C++) Cocos2d-Mac (Obj-C) Cocos2d-XNA Windows Phone 7 (C#) Cocos2d-HTML5 Web (Javascript) Cocos3D (Obj-C) Thursday, June 21, 12
  • 8. Cross Device, Cross Resolution Thursday, June 21, 12
  • 10. And most importantly.. Tons of great features for games SceneTransitionsSprite Sheets Effects: Lense, Ripple,Wave.. Actions: Move, Rotate, Scale.. Integrated Physics Engines Sound Support Tile Map Support Text RenderingParticle Systems Parallax Scrolling Shaders (v2.0)Ribbons Thursday, June 21, 12
  • 16. Director & Scenes Intro Main Menu Level I Level 2 Victory Options High Scores LossDirector ★ Game made up of “game screens” called Scenes ★ Each Scene can be considered a separate app ★ Director handles main window and executes Scenes Thursday, June 21, 12
  • 17. Layers ★ Each Scene contains several full screen Layers ★ Layers contain Sprites which are the game elements ★ Layers useful for Controls, Background, Labels, Menus. Thursday, June 21, 12
  • 18. Nodes Nodes are anything that gets drawn or contains things that get drawn (= Scene, Layer, Sprite) Can: ★ Contain other Nodes ★ Schedule periodic callbacks ★ Execute Actions Thursday, June 21, 12
  • 19. Sprites in Action Create CCSpriteFrame* spriteFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"sprite.png"]; CCSprite* sprite = [CCSprite spriteWithSpriteFrame:spriteFrame]; Thursday, June 21, 12
  • 20. Sprites in Action Add to Layer sprite.position = ccp(x, y); [layer addChild:sprite z:5 tag:666]; (0,0) winSize.height winSize.width (x,y) at anchor point Thursday, June 21, 12
  • 21. Sprites in Action Move CCMoveTo *moveToAction = [CCMoveTo actionWithDuration:duration position:newPosition]; [sprite runAction:moveToAction]; Properties can be transformed directly or through actions Thursday, June 21, 12
  • 22. Sprites in Action Scale/Rotate CCScaleTo *scaleToAction = [CCScaleTo actionWithDuration:duration scale:scale]; CCRotateBy *rotateByAction = [CCRotateBy actionWithDuration:duration angle:angle]; CCSequence *sequence = [CCSequence actions:scaleToAction, rotateByAction, nil]; [sprite runAction:sequence]; Thursday, June 21, 12
  • 23. Sprites in Action Animate CCAnimation* animation = [[CCAnimationCache sharedAnimationCache] animationByName:@"animation"]; CCAnimate* animateAction = [CCAnimate actionWithAnimation:animation]; [sprite runAction:animateAction]; Thursday, June 21, 12
  • 24. Sprites in Action Schedule Updates [scene schedule:@selector(updateSprite:) interval:interval]; Thursday, June 21, 12
  • 25. Actions Can be performed on Sprites or any Node Basic Move, Scale, Rotate, Bezier, Hide, Fade,Tint.. Composition Sequence, Repeat, Spawn, RepeatForever.. Ease Ease, EaseExponential, EaseBounce.. Effects Lens, Liquid, Ripple, Shaky,Twirl,Waves.. Special CallFunc, Follow.. Thursday, June 21, 12
  • 26. Spritesheets ★ Added as a child to the layer ★ Created withTexturePacker or Zwoptex ★ Memory considerations, 16bit images, .pvr.ccz Thursday, June 21, 12
  • 27. Controls ★ Implement directly based on CCStandardTouchDelegate ★ Can use UIGestureRecognizer classes ★ Open source implementations of joypad/buttons available - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; Thursday, June 21, 12
  • 28. Let’s Make a Game! Part 3: Thursday, June 21, 12
  • 29. Let’s Make a Game! ..but first we need a story, graphics, music and sfx :) Part 3: Thursday, June 21, 12
  • 30. Because he likes to kill paratroopers Para-Shoot Thursday, June 21, 12
  • 31. Graphics Benjamin Radchek Sprites by The_Protoganist and _Allen_ http://www.freewebs.com/teh_pro/sprites.htm Thursday, June 21, 12
  • 32. Music & SFX Explosive Attack by McTricky @ Sakari Infinity http://www.sakari-infinity.net/author/McTricky Background music, shoot sound, death sound Thursday, June 21, 12
  • 33. Music & SFX Explosive Attack by McTricky @ Sakari Infinity http://www.sakari-infinity.net/author/McTricky Background music, shoot sound, death sound Thursday, June 21, 12
  • 35. Steps for making Para-Shoot Application Setup Step 1: Adding Background Step 2: Adding Our Hero Step 3: Adding Bad Guys (Game Logic) Step 4: Killing Bad Guys (Adding UI) Step 5: Check for Bad Guy Death Step 6: Animating Our Hero Step 7: Animating Bad Guys Dying Step 8: Adding Body Count Step 9: Adding Sound & Music Thursday, June 21, 12
  • 37. @interface HelloWorldLayer : CCLayer { ! // Player sprite ! CCSprite *_player; // Target and bullet sprite arrays ! NSMutableArray *_targets; NSMutableArray *_bullets; ! // Body count counter and isShooting flag int _bodyCount; BOOL _isShooting; ! ! // For body count label ! CCLabelTTF *_labelTitle; ! CCLabelTTF *_labelCount; } HelloWorldScene.h Thursday, June 21, 12
  • 38. HelloWorldScene.m // Create the new scene including this layer +(id) scene { ! // Create the scene ! CCScene *scene = [CCScene node]; ! ! // Create the layer ! HelloWorldLayer *layer = [HelloWorldLayer node]; ! ! // add layer as a child to scene ! [scene addChild: layer]; ! ! // return the scene ! return scene; } Thursday, June 21, 12
  • 40. Step 1:Adding Background (In init) // Get the window size to place elements CGSize winSize = [[CCDirector sharedDirector] winSize]; // Add the background image CCSprite *background = [CCSprite spriteWithFile:@"background.png"]; background.position = ccp(winSize.width/2, winSize.height/2); [self addChild:background z:0]; Thursday, June 21, 12
  • 42. Step 2:Adding Our Hero (In init) // Load the sprite sheet CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"parashoot.pvr.ccz"]; [self addChild:batchNode]; // Load the sprites into the shareSpriteFrameCache [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"parashoot.plist"]; Preload the spritesheet Thursday, June 21, 12
  • 43. Step 2:Adding Our Hero // Add the player sprite CCSpriteFrame* playerFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"player_01.png"]; _player = [CCSprite spriteWithSpriteFrame:playerFrame]; _player.position = ccp(_player.contentSize.width/2 + 10, winSize.height/2); [self addChild:_player z:1]; Add the hero sprite Thursday, June 21, 12
  • 44. Step 2:Adding Our Hero Thursday, June 21, 12
  • 45. Step 3:Adding Bad Guys (Game Logic) (in init) [self schedule:@selector(addTarget:) interval:1.0f]; Schedule a new target every second Thursday, June 21, 12
  • 46. // Create a new enemy -(void)addTarget:(ccTime)dt { // Create the target sprite CCSpriteFrame *targetFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"target.png"]; !CCSprite *target = [CCSprite spriteWithSpriteFrame:targetFrame]; // Add the target to the layer and the array ! [self addChild:target]; ! [_targets addObject:target]; Step 3:Adding Bad Guys (Game Logic) Create a sprite for the target Thursday, June 21, 12
  • 47. Step 3:Adding Bad Guys (Game Logic) ! // Determine where to spawn the target along the X axis ! CGSize winSize = [[CCDirector sharedDirector] winSize]; // Find a random X for the target in the right half of the screen ! int minX = winSize.width/2; ! int maxX = winSize.width - target.contentSize.width; ! int rangeX = maxX - minX; ! int actualX = (arc4random() % rangeX) + minX; target.position = ccp(actualX, 320); target.anchorPoint = ccp(0, 0); ! // Determine speed of the target ! int minDuration = 2.0; ! int maxDuration = 4.0; ! int rangeDuration = maxDuration - minDuration; ! int actualDuration = (arc4random() % rangeDuration) + minDuration; Generate a random x position for the target Thursday, June 21, 12
  • 48. Step 3:Adding Bad Guys (Game Logic) // Create and run the actions CCMoveTo* moveTarget = [CCMoveTo actionWithDuration:actualDuration ! ! ! position:ccp(actualX, -target.contentSize.height/2)]; CCCallFuncN* actionForTargetMoveDidFinish = [CCCallFuncN actionWithTarget:self selector:@selector(targetMoveFinished:)]; [target runAction:[CCSequence actions:moveTarget, actionForTargetMoveDidFinish, nil]]; Create a move action for the target with a callback when reaching the bottom Thursday, June 21, 12
  • 49. Step 3:Adding Bad Guys (Game Logic) // Method for removing a target that has died or reached the bottom -(void)targetMoveFinished:(id)sender { ! CCSprite *target = (CCSprite *)sender; [self removeChild:target cleanup:YES]; ! [_targets removeObject:target]; } Add the callback method for a target that dies or reaches the bottom Thursday, June 21, 12
  • 50. Step 3:Adding Bad Guys (Game Logic) Thursday, June 21, 12
  • 51. Step 4: Killing Bad Guys (Adding UI) - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { ! // Choose one of the touches to work with ! UITouch *touch = [touches anyObject]; ! CGPoint location = [touch locationInView:[touch view]]; ! location = [[CCDirector sharedDirector] convertToGL:location]; ! if (!_isShooting) { _isShooting = YES; Detect the touch Thursday, June 21, 12
  • 52. Step 4: Killing Bad Guys (Adding UI) // Create the bullet CCSpriteFrame* bulletFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"bullet.png"]; CCSprite* bulletSprite = [CCSprite spriteWithSpriteFrame:bulletFrame]; bulletSprite.position = _player.position; // Bullet actions CCCallFuncN* actionForRemoveBullet = [CCCallFuncN actionWithTarget:self selector:@selector(removeBullet:)]; CCMoveBy* bulletMoveBy = [CCMoveBy actionWithDuration:1.0f position:ccp(winSize.width, 0)]; [bulletSprite runAction:[CCSequence actionOne:bulletMoveBy two:actionForRemoveBullet]]; // Add bullet to layer and array [self addChild:bulletSprite]; [_bullets addObject:bulletSprite]; Create the bullet Thursday, June 21, 12
  • 53. Step 4: Killing Bad Guys (Adding UI) Thursday, June 21, 12
  • 54. Step 5: Check for Bad Guy Death -(void)update:(ccTime)dt { CCSprite* bulletToRemove = nil; for (CCSprite *bullet in _bullets) { for (CCSprite* target in _targets) { CGRect targetBox = CGRectMake(target.position.x, target.position.y, [target boundingBox].size.width, [target boundingBox].size.height); // Check if bullet is in the target's bounding box if (CGRectContainsPoint(targetBox, bullet.position)) { // Animate target death and remove target bulletToRemove = bullet; } } } // Remove bullet if target was hit if (bulletToRemove != nil) { [self removeChild:bulletToRemove cleanup:YES]; [_bullets removeObject:bulletToRemove]; } } Thursday, June 21, 12
  • 55. Step 5: Check for Bad Guy Death Thursday, June 21, 12
  • 56. Step 6:Animating Our Hero (In init) // Load the animation for player NSMutableArray *animFrames1 = [NSMutableArray array]; for (int i = 1; i < 12; i++) { CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"player_%02d.png",i]]; ! [animFrames1 addObject:frame]; } [[CCAnimationCache sharedAnimationCache] addAnimation:[CCAnimation animationWithFrames:animFrames1 delay:FRAME_DELAY] name:@"player"];! Preload the animation from the spritesheet Thursday, June 21, 12
  • 57. Step 6:Animating Our Hero (In ccTouchesEnded) // Actions for shooting animation CCCallFunc* actionForShootDidEnd = [CCCallFunc actionWithTarget:self selector:@selector(shootDidEnd)]; CCAnimation* playerShootAnimation = [[CCAnimationCache sharedAnimationCache] animationByName:@"player"]; CCAnimate* shootAnimate = [CCAnimate actionWithAnimation:playerShootAnimation]; [_player runAction:[CCSequence actionOne:shootAnimate two:actionForShootDidEnd]]; Animate the hero when shooting Thursday, June 21, 12
  • 58. Step 6:Animating Our Hero Thursday, June 21, 12
  • 59. Step 7:Animating Bad Guys Dying (in update) // Set up actions for animation and target removal CCCallFuncN* actionForDeathDidFinish = [CCCallFuncN actionWithTarget:self selector:@selector(targetMoveFinished:)]; CCAnimate* deathAnimation = [CCAnimate actionWithAnimation:[[CCAnimationCache sharedAnimationCache] animationByName:@"death"] restoreOriginalFrame:NO]; [target runAction:[CCSequence actionOne:deathAnimation two:actionForDeathDidFinish]]; Thursday, June 21, 12
  • 60. Step 7:Animating Bad Guys Dying Thursday, June 21, 12
  • 61. Step 8:Adding Body Count (In init) NSString* bodyCountString = [NSString stringWithFormat:@"%d", _bodyCount]; _labelCount = [CCLabelTTF labelWithString:bodyCountString fontName:@"Arial" fontSize:16]; _labelCount.color = ccc3(0,0,0); _labelCount.position = ccp(110, winSize.height - 16); [self addChild:_labelCount z:2]; (In ccTouchesEnded) _bodyCount++; NSString* bodyCountString = [NSString stringWithFormat:@"%d", _bodyCount];! [_labelCount setString:bodyCountString]; Thursday, June 21, 12
  • 62. Step 8:Adding Body Count Thursday, June 21, 12
  • 63. Step 9:Adding Sound & Music (In init) ! // Start background music, set lower volume ! SimpleAudioEngine.sharedEngine.backgroundMusicVolume = 0.4f; ! [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"explosive_attack.mp3"]; (In ccTouchesEnded) ! // Play sound effect on every shot and on death ! [[SimpleAudioEngine sharedEngine] playEffect:@"shot.wav"]; ! [[SimpleAudioEngine sharedEngine] playEffect:@"death.wav"]; Thursday, June 21, 12
  • 64. Step 9:Adding Sound & Music Thursday, June 21, 12
  • 66. Para-Shoot 2.0 Enemies can move and attack Joypad + HUD Move our hero Different weapons, power ups and health Game menu and high scores Levels Save/Load Game Refactor code (More scenes and layers) Thursday, June 21, 12
  • 67. Refactoring Para-Shoot Intro Main Menu Level X Victory Options High Score Loss Level X Background Player Bad Guys Joypad/HUD Scenes: Layers: Thursday, June 21, 12
  • 68. More stuff to explore ★ Physics Engines - Chipmunk and Box2D ★ Particle System ★ Tilemaps ★ Menu Interface Thursday, June 21, 12
  • 69. Where can you learn more Cocos2D Demo Library (Comes with Cocos) Wiki: http://cocos2d-iphone.org/wiki Ray Wenderlich: http://www.raywenderlich.com Steffen Itterheim: http://learn-cocos2d.com SapusTongue Source Code: http://www.sapusmedia.com/sources Thursday, June 21, 12