SlideShare a Scribd company logo
ThomasV. Frauenhofer
Beret Applications LLC
360iDev Austin, November, 2010
Introduction to Cocos2d:
Learning from Examples
Monday, November 8, 2010
Who am I?
• Software developer for 28+ years
• IBM’er by day, mobile developer at night
• 10 years in Palm OS mobile development
• (May it rest in peace)
Monday, November 8, 2010
Chromatic Cosmos
• Cocos2d-Based
Tower defense
game released last
August
• FREE on iTunes
this week!
http://beret.com
Monday, November 8, 2010
Overview
• Motivation - Why Cocos2D?
• Definition of simple project (BlockGame)
• Building the project
• We won’t finish, but you’ll get all the
code
Monday, November 8, 2010
Why Cocos2D?
Monday, November 8, 2010
Why Cocos2D?
• Simple 2D Gaming SDK
• Built upon the OpenGL API’s
• Rich Objective-C API
• Used in thousands of apps
• Very active developer community
Monday, November 8, 2010
Even more Why Cocos2D
• Integrates with some very useful libraries
• Physics (Chimpunk, Box2D)
• Sound (CocosDension)
• Game boards (cocoslive)
• And others...
Monday, November 8, 2010
Things to Consider
• Cocos2D is an open-source project
• Read the licenses carefully
• Cocos2D has changed A LOT over the past year
• Support for newer iOS versions/features
• Changes in names and abstractions used
• Adopting a new version may be a significant
amount of work
Monday, November 8, 2010
A brief overview of
Cocos2D
Monday, November 8, 2010
High-level Cocos2d
• The Director (CCDirector) is the boss
• Manages the window and the scenes
• Manages the interactions with the
underlying OpenGL environment
• A game has one or more scenes
(CCScene)
• Think of a scene in the thematic sense
Monday, November 8, 2010
Sample Scene workflow
source: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts
Monday, November 8, 2010
It all started with a (CC)Node...
• CCNode is the base class of (almost) all Cocos2D
classes
• Many attributes are defined
• Position
• Size
• z-order
• etc...
Monday, November 8, 2010
• The origin is the lower
left-hand corner of the
screen
• The position of an object is
the center of the object
image source: http://www.anima-entertainment.de
A quick note on coordinates
Monday, November 8, 2010
Layers in Cocos2d
source: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts
Monday, November 8, 2010
Layers
• A layer (CCLayer) is where a user interacts
with Cocos2d objects
• A layer handles touch and accelerometer
events
• A layer contains other layers and sprites
Monday, November 8, 2010
Sprites
• A sprite (CCSprite) is an active object in
your game
• 2 dimensional object
• Has an image (not generated)
• Can be animated, touched, moved, etc.
Monday, November 8, 2010
Animated Sprites
• Use of Batch Sprites/Sprite Sheets/Atlas
Sprites (versus individual image files)
• Depending on your version/history with
Cocos2d
• Uses OpenGL Texture Atlas to provide
higher animation performance
Monday, November 8, 2010
Actions and Animation
• You animate a sprite using the CCAnimation
class
• You make a sprite move using derivatives of
the CCAction class
• You can specify sequences of actions
(CCSequence) and actions done in parallel
(CCSpawn)
Monday, November 8, 2010
Block Game - a simple
game to introduce you
to Cocos2d
Monday, November 8, 2010
Commentary
• It is important to know what you are building
before you build it...
• Design, look, interaction
• Cheaper and faster to design than to code
• ...but don’t go overboard
• Avoid “analysis paralysis”
• Iterate - design, code, test, rinse, repeat
Monday, November 8, 2010
In short...
• Make it work
• Next, make it good
• Next, make it GREAT!
Monday, November 8, 2010
Block Game
• Teach you about:
• Sprites
• Actions
• Collision detection
Monday, November 8, 2010
Game Elements
Piece user
drags to
remove...
...one of the
boxes
moving
across the
bottom of
the screen...
Monday, November 8, 2010
Game Elements
...while
avoiding the
blockers who
are
protecting
the boxes
Monday, November 8, 2010
Additional Notes
• Single-color background
• I chose yellow, but you could pick another color
• You can use either color squares or dice images for
UserSprite/boxes
• Both are included in basic sample project
• Using Cocos2d version 0.99.5 beta 3
Monday, November 8, 2010
Game Items
• The piece the user moves around is a
sprite (UserSprite)
• The boxes are sprites (BoxSprite)
• Blockers that move back and forth above
and below the conveyor belt
Monday, November 8, 2010
Game Actions
• Touch and move UserSprite
• Boxes just move right-to-left
• New boxes are periodically added on
right
• Blockers move back and forth
• UserSprite can collide with boxes and
blockers
Monday, November 8, 2010
Miscellanous
• Using XCode 3.2.5
• Using cocos2d-iphone-0.99.5-beta3
• Requires iOS 4.0+ (4.2 for iPad versions)
Monday, November 8, 2010
Building the project
Monday, November 8, 2010
Setting the scene
• Set orientation to portrait (Example 01)
• Set background color yellow (Example 02)
Monday, November 8, 2010
Add the UserSprite
• Example 03
Monday, November 8, 2010
Make UserSprite move
• Example 04
Monday, November 8, 2010
Add the Boxes
• Example 05
Monday, November 8, 2010
Collisions between
UserSprite and Boxes
• Example 06
Monday, November 8, 2010
Add the Blockers
• Example 07
Monday, November 8, 2010
Miscellaneous changes
• Random start values - Example 08
• CocosDension (Sound) - Example 09
• iPad support - Example 10
Monday, November 8, 2010
Miscellaneous
Monday, November 8, 2010
For more information
• http://cocos2d-iphone.org - Cocos2d for iOS information
• New book: Learn iPhone and iPad Cocos2D Game Development
(Apress)
• Previous 360iDev Presentations, including:
• “Introduction to 2d Game Programming Using
cocos2d” (360iDev Denver 2009)
• “Cocos2D + Box2D” (360iDev San Jose)
• Blogs (Ray Wenderlich’s is especially good)
Monday, November 8, 2010
From this presentation
• Slides:
• http://dl.dropbox.com/u/5375467/Introduction%20to%20Cocos2d.key
• http://dl.dropbox.com/u/5375467/Introduction%20to%20Cocos2d.pdf
• Sample code:
• http://dl.dropbox.com/u/5375467/IntroToCocos2DSamples.zip
Monday, November 8, 2010
My Contact Information
• Email: tvf@beret.com
• Our company: http://beret.com
• Web: http://tomfrauenhofer.com
• Twitter: @tvf
Monday, November 8, 2010
Thank you!
(and don’t forget the Game Jam!)
http://gamejam.360idev.com
Monday, November 8, 2010

More Related Content

Viewers also liked

PACUARA POSTER INFORMATIVO
PACUARA POSTER INFORMATIVOPACUARA POSTER INFORMATIVO
PACUARA POSTER INFORMATIVO
AISAI
 
Pogramació llg.catalana i literatura 4t. ESO
Pogramació llg.catalana i literatura 4t. ESOPogramació llg.catalana i literatura 4t. ESO
Pogramació llg.catalana i literatura 4t. ESO
Pepeta2
 
Voce e-especial-
Voce e-especial-Voce e-especial-
Voce e-especial-
IFC Campus Camboriú
 
Unit1 lesson4
Unit1 lesson4Unit1 lesson4
Unit1 lesson4
kimmcminn
 
IKT arbeidskrav 3
IKT arbeidskrav 3IKT arbeidskrav 3
IKT arbeidskrav 3
AnneSofie65
 
Twitter
TwitterTwitter
Twitter
Lau Laverde
 
Diane presentation 2
Diane presentation 2Diane presentation 2
Diane presentation 2
Diane M. Pictrowski
 
Ambientes virtuales
Ambientes virtualesAmbientes virtuales
Ambientes virtuales
Vision Mundial
 
11016 14 threads
11016 14 threads11016 14 threads
julio
juliojulio
Ep300 gb-r2
Ep300 gb-r2Ep300 gb-r2
Ep300 gb-r2
Arief Dwiyanto
 
Delicious food by texastastes.com
Delicious food by texastastes.comDelicious food by texastastes.com
Delicious food by texastastes.com
Texastastes.com
 
Harris County Home Sales Report November 2014
Harris County Home Sales Report November 2014Harris County Home Sales Report November 2014
Harris County Home Sales Report November 2014
Jeff Bulman
 
residential plot in mohali
residential plot in mohaliresidential plot in mohali
residential plot in mohali
Vinod Sharma
 
Hoja de vida alexander marios arce
Hoja de vida alexander marios arceHoja de vida alexander marios arce
Hoja de vida alexander marios arce
Ronald Arroyo
 
Trusting Our Internet
Trusting Our InternetTrusting Our Internet
Trusting Our Internet
twizzler290
 
Lapnotebooks
LapnotebooksLapnotebooks
Lapnotebooks
UGMEX
 
Arbol
ArbolArbol

Viewers also liked (20)

PACUARA POSTER INFORMATIVO
PACUARA POSTER INFORMATIVOPACUARA POSTER INFORMATIVO
PACUARA POSTER INFORMATIVO
 
Pogramació llg.catalana i literatura 4t. ESO
Pogramació llg.catalana i literatura 4t. ESOPogramació llg.catalana i literatura 4t. ESO
Pogramació llg.catalana i literatura 4t. ESO
 
Voce e-especial-
Voce e-especial-Voce e-especial-
Voce e-especial-
 
Unit1 lesson4
Unit1 lesson4Unit1 lesson4
Unit1 lesson4
 
IKT arbeidskrav 3
IKT arbeidskrav 3IKT arbeidskrav 3
IKT arbeidskrav 3
 
Visita concell barco
Visita concell barcoVisita concell barco
Visita concell barco
 
Twitter
TwitterTwitter
Twitter
 
Diane presentation 2
Diane presentation 2Diane presentation 2
Diane presentation 2
 
Ambientes virtuales
Ambientes virtualesAmbientes virtuales
Ambientes virtuales
 
11016 14 threads
11016 14 threads11016 14 threads
11016 14 threads
 
julio
juliojulio
julio
 
Ep300 gb-r2
Ep300 gb-r2Ep300 gb-r2
Ep300 gb-r2
 
Los Silencios
Los SilenciosLos Silencios
Los Silencios
 
Delicious food by texastastes.com
Delicious food by texastastes.comDelicious food by texastastes.com
Delicious food by texastastes.com
 
Harris County Home Sales Report November 2014
Harris County Home Sales Report November 2014Harris County Home Sales Report November 2014
Harris County Home Sales Report November 2014
 
residential plot in mohali
residential plot in mohaliresidential plot in mohali
residential plot in mohali
 
Hoja de vida alexander marios arce
Hoja de vida alexander marios arceHoja de vida alexander marios arce
Hoja de vida alexander marios arce
 
Trusting Our Internet
Trusting Our InternetTrusting Our Internet
Trusting Our Internet
 
Lapnotebooks
LapnotebooksLapnotebooks
Lapnotebooks
 
Arbol
ArbolArbol
Arbol
 

Similar to Introduction to-cocos2d

Cardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR ExperiencesCardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR Experiences
Mark Billinghurst
 
3D scanner using kinect
3D scanner using kinect3D scanner using kinect
3D scanner using kinect
Mehdi Saman Booy
 
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
gamifi.cc
 
Cocos2d programming
Cocos2d programmingCocos2d programming
Cocos2d programming
Changwon National University
 
Games on AppleWatch
Games on AppleWatchGames on AppleWatch
Games on AppleWatch
Peter Tuszynski
 
Building VR Applications For Google Cardboard
Building VR Applications For Google CardboardBuilding VR Applications For Google Cardboard
Building VR Applications For Google Cardboard
Mark Billinghurst
 
Kinect
KinectKinect
Kinect
진식 김
 
BarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of ThingsBarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of Things
Andy Gelme
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
Developing AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityDeveloping AR and VR Experiences with Unity
Developing AR and VR Experiences with Unity
Mark Billinghurst
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
Changwon National University
 
Confrontation Pipeline and SCons
Confrontation Pipeline and SConsConfrontation Pipeline and SCons
Confrontation Pipeline and SCons
slantsixgames
 
Building AR and VR Experiences
Building AR and VR ExperiencesBuilding AR and VR Experiences
Building AR and VR Experiences
Mark Billinghurst
 
Cross Game Dev with Corona
Cross Game Dev with CoronaCross Game Dev with Corona
Cross Game Dev with Corona
Shawn Grimes
 
Cross Platform Mobile Game Development
Cross Platform Mobile Game DevelopmentCross Platform Mobile Game Development
Cross Platform Mobile Game Development
Allan Davis
 
Developing VR Experiences with Unity
Developing VR Experiences with UnityDeveloping VR Experiences with Unity
Developing VR Experiences with Unity
Mark Billinghurst
 
Cocos2d game programming 2
Cocos2d game programming 2Cocos2d game programming 2
Cocos2d game programming 2
Changwon National University
 
OpenVR at Arduino Day Malmö
OpenVR at Arduino Day MalmöOpenVR at Arduino Day Malmö
OpenVR at Arduino Day Malmö
Ahmet YILDIRIM
 
Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013
Guille Polito
 
XNAPresentation
XNAPresentationXNAPresentation
XNAPresentation
Reuben Ahmed
 

Similar to Introduction to-cocos2d (20)

Cardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR ExperiencesCardboard VR: Building Low Cost VR Experiences
Cardboard VR: Building Low Cost VR Experiences
 
3D scanner using kinect
3D scanner using kinect3D scanner using kinect
3D scanner using kinect
 
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...
 
Cocos2d programming
Cocos2d programmingCocos2d programming
Cocos2d programming
 
Games on AppleWatch
Games on AppleWatchGames on AppleWatch
Games on AppleWatch
 
Building VR Applications For Google Cardboard
Building VR Applications For Google CardboardBuilding VR Applications For Google Cardboard
Building VR Applications For Google Cardboard
 
Kinect
KinectKinect
Kinect
 
BarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of ThingsBarCamp Melbourne 2012: Internet of Things
BarCamp Melbourne 2012: Internet of Things
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
Developing AR and VR Experiences with Unity
Developing AR and VR Experiences with UnityDeveloping AR and VR Experiences with Unity
Developing AR and VR Experiences with Unity
 
Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
 
Confrontation Pipeline and SCons
Confrontation Pipeline and SConsConfrontation Pipeline and SCons
Confrontation Pipeline and SCons
 
Building AR and VR Experiences
Building AR and VR ExperiencesBuilding AR and VR Experiences
Building AR and VR Experiences
 
Cross Game Dev with Corona
Cross Game Dev with CoronaCross Game Dev with Corona
Cross Game Dev with Corona
 
Cross Platform Mobile Game Development
Cross Platform Mobile Game DevelopmentCross Platform Mobile Game Development
Cross Platform Mobile Game Development
 
Developing VR Experiences with Unity
Developing VR Experiences with UnityDeveloping VR Experiences with Unity
Developing VR Experiences with Unity
 
Cocos2d game programming 2
Cocos2d game programming 2Cocos2d game programming 2
Cocos2d game programming 2
 
OpenVR at Arduino Day Malmö
OpenVR at Arduino Day MalmöOpenVR at Arduino Day Malmö
OpenVR at Arduino Day Malmö
 
Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013Virtual Smalltalk Images - IWST - ESUG 2013
Virtual Smalltalk Images - IWST - ESUG 2013
 
XNAPresentation
XNAPresentationXNAPresentation
XNAPresentation
 

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

Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
Steven Carlson
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
Bhajan Mehta
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
Camunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptxCamunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptx
ZachWylie3
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Zilliz
 
Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
SynapseIndia
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
FIDO Alliance
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
ssuser1915fe1
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
shanihomely
 
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
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
SynapseIndia
 
Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
SubhamMandal40
 
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
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
Ivanti
 
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
alexjohnson7307
 
The History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal EmbeddingsThe History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal Embeddings
Zilliz
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
janagijoythi
 
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
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
David Wilson
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
Baishakhi Ray
 

Recently uploaded (20)

Vulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive OverviewVulnerability Management: A Comprehensive Overview
Vulnerability Management: A Comprehensive Overview
 
Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17Mule Experience Hub and Release Channel with Java 17
Mule Experience Hub and Release Channel with Java 17
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
Camunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptxCamunda Chapter NY Meetup July 2024.pptx
Camunda Chapter NY Meetup July 2024.pptx
 
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
Garbage In, Garbage Out: Why poor data curation is killing your AI models (an...
 
Tailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer InsightsTailored CRM Software Development for Enhanced Customer Insights
Tailored CRM Software Development for Enhanced Customer Insights
 
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
UX Webinar Series: Essentials for Adopting Passkeys as the Foundation of your...
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
 
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
Premium Girls Call Mumbai 9920725232 Unlimited Short Providing Girls Service ...
 
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
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
 
Sonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdfSonkoloniya documentation - ONEprojukti.pdf
Sonkoloniya documentation - ONEprojukti.pdf
 
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...
 
Patch Tuesday de julio
Patch Tuesday de julioPatch Tuesday de julio
Patch Tuesday de julio
 
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
leewayhertz.com-AI agents for healthcare Applications benefits and implementa...
 
The History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal EmbeddingsThe History of Embeddings & Multimodal Embeddings
The History of Embeddings & Multimodal Embeddings
 
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.pptxMAKE MONEY ONLINE Unlock Your Income Potential Today.pptx
MAKE MONEY ONLINE Unlock Your Income Potential Today.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...
 
Mastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for SuccessMastering OnlyFans Clone App Development: Key Strategies for Success
Mastering OnlyFans Clone App Development: Key Strategies for Success
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
 

Introduction to-cocos2d

  • 1. ThomasV. Frauenhofer Beret Applications LLC 360iDev Austin, November, 2010 Introduction to Cocos2d: Learning from Examples Monday, November 8, 2010
  • 2. Who am I? • Software developer for 28+ years • IBM’er by day, mobile developer at night • 10 years in Palm OS mobile development • (May it rest in peace) Monday, November 8, 2010
  • 3. Chromatic Cosmos • Cocos2d-Based Tower defense game released last August • FREE on iTunes this week! http://beret.com Monday, November 8, 2010
  • 4. Overview • Motivation - Why Cocos2D? • Definition of simple project (BlockGame) • Building the project • We won’t finish, but you’ll get all the code Monday, November 8, 2010
  • 6. Why Cocos2D? • Simple 2D Gaming SDK • Built upon the OpenGL API’s • Rich Objective-C API • Used in thousands of apps • Very active developer community Monday, November 8, 2010
  • 7. Even more Why Cocos2D • Integrates with some very useful libraries • Physics (Chimpunk, Box2D) • Sound (CocosDension) • Game boards (cocoslive) • And others... Monday, November 8, 2010
  • 8. Things to Consider • Cocos2D is an open-source project • Read the licenses carefully • Cocos2D has changed A LOT over the past year • Support for newer iOS versions/features • Changes in names and abstractions used • Adopting a new version may be a significant amount of work Monday, November 8, 2010
  • 9. A brief overview of Cocos2D Monday, November 8, 2010
  • 10. High-level Cocos2d • The Director (CCDirector) is the boss • Manages the window and the scenes • Manages the interactions with the underlying OpenGL environment • A game has one or more scenes (CCScene) • Think of a scene in the thematic sense Monday, November 8, 2010
  • 11. Sample Scene workflow source: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts Monday, November 8, 2010
  • 12. It all started with a (CC)Node... • CCNode is the base class of (almost) all Cocos2D classes • Many attributes are defined • Position • Size • z-order • etc... Monday, November 8, 2010
  • 13. • The origin is the lower left-hand corner of the screen • The position of an object is the center of the object image source: http://www.anima-entertainment.de A quick note on coordinates Monday, November 8, 2010
  • 14. Layers in Cocos2d source: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:basic_concepts Monday, November 8, 2010
  • 15. Layers • A layer (CCLayer) is where a user interacts with Cocos2d objects • A layer handles touch and accelerometer events • A layer contains other layers and sprites Monday, November 8, 2010
  • 16. Sprites • A sprite (CCSprite) is an active object in your game • 2 dimensional object • Has an image (not generated) • Can be animated, touched, moved, etc. Monday, November 8, 2010
  • 17. Animated Sprites • Use of Batch Sprites/Sprite Sheets/Atlas Sprites (versus individual image files) • Depending on your version/history with Cocos2d • Uses OpenGL Texture Atlas to provide higher animation performance Monday, November 8, 2010
  • 18. Actions and Animation • You animate a sprite using the CCAnimation class • You make a sprite move using derivatives of the CCAction class • You can specify sequences of actions (CCSequence) and actions done in parallel (CCSpawn) Monday, November 8, 2010
  • 19. Block Game - a simple game to introduce you to Cocos2d Monday, November 8, 2010
  • 20. Commentary • It is important to know what you are building before you build it... • Design, look, interaction • Cheaper and faster to design than to code • ...but don’t go overboard • Avoid “analysis paralysis” • Iterate - design, code, test, rinse, repeat Monday, November 8, 2010
  • 21. In short... • Make it work • Next, make it good • Next, make it GREAT! Monday, November 8, 2010
  • 22. Block Game • Teach you about: • Sprites • Actions • Collision detection Monday, November 8, 2010
  • 23. Game Elements Piece user drags to remove... ...one of the boxes moving across the bottom of the screen... Monday, November 8, 2010
  • 24. Game Elements ...while avoiding the blockers who are protecting the boxes Monday, November 8, 2010
  • 25. Additional Notes • Single-color background • I chose yellow, but you could pick another color • You can use either color squares or dice images for UserSprite/boxes • Both are included in basic sample project • Using Cocos2d version 0.99.5 beta 3 Monday, November 8, 2010
  • 26. Game Items • The piece the user moves around is a sprite (UserSprite) • The boxes are sprites (BoxSprite) • Blockers that move back and forth above and below the conveyor belt Monday, November 8, 2010
  • 27. Game Actions • Touch and move UserSprite • Boxes just move right-to-left • New boxes are periodically added on right • Blockers move back and forth • UserSprite can collide with boxes and blockers Monday, November 8, 2010
  • 28. Miscellanous • Using XCode 3.2.5 • Using cocos2d-iphone-0.99.5-beta3 • Requires iOS 4.0+ (4.2 for iPad versions) Monday, November 8, 2010
  • 29. Building the project Monday, November 8, 2010
  • 30. Setting the scene • Set orientation to portrait (Example 01) • Set background color yellow (Example 02) Monday, November 8, 2010
  • 31. Add the UserSprite • Example 03 Monday, November 8, 2010
  • 32. Make UserSprite move • Example 04 Monday, November 8, 2010
  • 33. Add the Boxes • Example 05 Monday, November 8, 2010
  • 34. Collisions between UserSprite and Boxes • Example 06 Monday, November 8, 2010
  • 35. Add the Blockers • Example 07 Monday, November 8, 2010
  • 36. Miscellaneous changes • Random start values - Example 08 • CocosDension (Sound) - Example 09 • iPad support - Example 10 Monday, November 8, 2010
  • 38. For more information • http://cocos2d-iphone.org - Cocos2d for iOS information • New book: Learn iPhone and iPad Cocos2D Game Development (Apress) • Previous 360iDev Presentations, including: • “Introduction to 2d Game Programming Using cocos2d” (360iDev Denver 2009) • “Cocos2D + Box2D” (360iDev San Jose) • Blogs (Ray Wenderlich’s is especially good) Monday, November 8, 2010
  • 39. From this presentation • Slides: • http://dl.dropbox.com/u/5375467/Introduction%20to%20Cocos2d.key • http://dl.dropbox.com/u/5375467/Introduction%20to%20Cocos2d.pdf • Sample code: • http://dl.dropbox.com/u/5375467/IntroToCocos2DSamples.zip Monday, November 8, 2010
  • 40. My Contact Information • Email: tvf@beret.com • Our company: http://beret.com • Web: http://tomfrauenhofer.com • Twitter: @tvf Monday, November 8, 2010
  • 41. Thank you! (and don’t forget the Game Jam!) http://gamejam.360idev.com Monday, November 8, 2010