SlideShare a Scribd company logo
Introduction to 2d Game
             Programming Using cocos2d




                            Serban Porumbescu
Thursday, October 1, 2009
www.hiddenelephant.com

Thursday, October 1, 2009
Overview
                • Why cocos2d?
                • Beginner Hurdles
                • cocos2d Basics
                • cocos2d Specifics
                • Samples and Tests
                • Resources

Thursday, October 1, 2009
Why cocos2d?

                • Well over 200 games shipped
                • Great licensing
                • Lots of features
                • Extremely active community
                • What’s your business?

Thursday, October 1, 2009
Beginner Hurdles



Thursday, October 1, 2009
Beginner Hurdles

                • Objective-C and Memory
                • Setting Up a cocos2d Project
                • Running Samples and Tests
                • Understanding Tests


Thursday, October 1, 2009
Learn Objective-C


                  Read: “Learning Objective-C: A Primer”




Thursday, October 1, 2009
Learn Memory
                             Management

                  Read: “Memory Management Programming
                  Guide for Cocoa”




Thursday, October 1, 2009
cocos2d Project Setup


                • Super easy ... now
                • sudo ./install_template.sh



Thursday, October 1, 2009
Thursday, October 1, 2009
Thursday, October 1, 2009
Thursday, October 1, 2009
Running Samples & Tests


                • Wonderful source of examples that people
                      seem to overlook
                • Once noticed, folks have issues running


Thursday, October 1, 2009
Thursday, October 1, 2009
Running Samples & Tests


                • Where are they and how do we run?



Thursday, October 1, 2009
Thursday, October 1, 2009
Thursday, October 1, 2009
Running Samples & Tests


                • Make sure to set both the “Active Target”
                      and the “Active Executable”




Thursday, October 1, 2009
Thursday, October 1, 2009
Thursday, October 1, 2009
Tests


                • Not games
                • Meant to exercise some specific functionality
                • Useful for figuring stuff out


Thursday, October 1, 2009
Tests
                • Structured very similarly
                • Some base test class



                • Instantiate new test by advancing through
                      NSStrings using NSClassFromString

Thursday, October 1, 2009
Tests


                • Let’s look at AtlasSpriteTest and
                      EaseActionsTest




Thursday, October 1, 2009
cocos2d Basics



Thursday, October 1, 2009
cocos2d Basics

                • Game has Scenes
                • Each Scene has some number of Layers
                • Layers capture user interaction and contain
                      sprites
                • Director manages the scenes

Thursday, October 1, 2009
Scenes
            • Screens in your game
            • Can almost think of them as separate apps




Thursday, October 1, 2009
Layers

                • Take up the entire screen
                • Setup to handle touch and accelerometer
                • Can contain other layers and sprites (and
                      other stuff)




Thursday, October 1, 2009
Sprites




Thursday, October 1, 2009
Director

                • Manages moving between Scenes
                • Pausing and running Scenes
                • Sets up OpenGL ES
                • Layer asks Director to move on


Thursday, October 1, 2009
Thursday, October 1, 2009
cocos2d Specifics



Thursday, October 1, 2009
Thursday, October 1, 2009
Important Classes
                •    CocosNode

                •    Scene

                •    Layer

                •    Director

                •    AtlasSprite

                •    AtlasSpriteManager




Thursday, October 1, 2009
CocosNode




Thursday, October 1, 2009
CocosNode

                • Lots of properties
                • position, scale, camera, OpenGL z position,
                      children
                • Most objects in cocos2d inherit from
                      CocosNode




Thursday, October 1, 2009
Scene




Thursday, October 1, 2009
Layer




Thursday, October 1, 2009
Director(s)




Thursday, October 1, 2009
AtlasSprite




Thursday, October 1, 2009
AtlasSpriteManager




Thursday, October 1, 2009
Sprite vs. AtlasSprite



Thursday, October 1, 2009
Sprites




Thursday, October 1, 2009
AtlasSprite




Thursday, October 1, 2009
Sprite vs. AtlasSprite


                • In general, don’t use Sprites
                • AtlasSprites way faster
                • It’s all about the OpenGL ES


Thursday, October 1, 2009
Samples and Tests



Thursday, October 1, 2009
Resources




                            http://www.cocos2d-iphone.org/

Thursday, October 1, 2009
Resources




       Wiki: http://www.cocos2d-iphone.org/wiki/doku.php/
Thursday, October 1, 2009
Resources


             Forums: http://www.cocos2d-iphone.org/forum/




Thursday, October 1, 2009
iPhoneGameJam.com




Thursday, October 1, 2009
Thanks!



Thursday, October 1, 2009

More Related Content

PDF
Magritte Magic
PDF
Yidev cocos2dx
PDF
Game development with Cocos2d-x Engine
PPTX
Cocos2dx와 c++11를 이용한 게임 개발
PPTX
Bitbucket
KEY
Git with bitbucket
PDF
Escape The Lab Tri Upa Slides
PDF
DDD Part3 Retrospective
Magritte Magic
Yidev cocos2dx
Game development with Cocos2d-x Engine
Cocos2dx와 c++11를 이용한 게임 개발
Bitbucket
Git with bitbucket
Escape The Lab Tri Upa Slides
DDD Part3 Retrospective

Similar to Introtoduction to cocos2d (20)

PDF
Introduction to Cocos2d
PDF
Introduction to-cocos2d
PDF
Nodes Cck And Panels
PDF
All The Little Pieces
PDF
Strategies Tech It Up
PDF
Testing In Agile
PDF
Processing
PDF
Plugin Testing
PDF
Addictive Websites
PDF
Wolkomir Project Colman 2010
PDF
BDW: How To Pitch Your Ideas
PDF
Talk About Configuration Management
PDF
Making Design By Committee Work
PDF
Noit ocon-2010
PDF
Open Source Tools For Freelancers
PDF
Splash
PDF
Plone on Amazon EC2
PDF
Better Quality through Scrum
PDF
Drizzle - Status, Principles and Ecosystem
PDF
Tkinter Does Not Suck
Introduction to Cocos2d
Introduction to-cocos2d
Nodes Cck And Panels
All The Little Pieces
Strategies Tech It Up
Testing In Agile
Processing
Plugin Testing
Addictive Websites
Wolkomir Project Colman 2010
BDW: How To Pitch Your Ideas
Talk About Configuration Management
Making Design By Committee Work
Noit ocon-2010
Open Source Tools For Freelancers
Splash
Plone on Amazon EC2
Better Quality through Scrum
Drizzle - Status, Principles and Ecosystem
Tkinter Does Not Suck
Ad

More from John Wilker (20)

PDF
Cranking Floating Point Performance Up To 11
PDF
Getting Started with OpenGL ES
PDF
User Input in a multi-touch, accelerometer, location aware world.
PDF
Physics Solutions for Innovative Game Design
PDF
Getting Oriented with MapKit: Everything you need to get started with the new...
PDF
Getting Started with iPhone Game Development
PDF
Internationalizing Your Apps
PDF
Optimizing Data Caching for iPhone Application Responsiveness
PDF
I Phone On Rails
PDF
Integrating Push Notifications in your iPhone application with iLime
PDF
Starting Core Animation
PDF
P2P Multiplayer Gaming
PDF
Using Concurrency To Improve Responsiveness
PDF
Leaving Interface Builder Behind
PDF
Mobile WebKit Development and jQTouch
PDF
Accelerometer and OpenGL
PDF
Deep Geek Diving into the iPhone OS and Framework
PDF
NSNotificationCenter vs. AppDelegate
PDF
Using SQLite
PDF
From Flash to iPhone
Cranking Floating Point Performance Up To 11
Getting Started with OpenGL ES
User Input in a multi-touch, accelerometer, location aware world.
Physics Solutions for Innovative Game Design
Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Started with iPhone Game Development
Internationalizing Your Apps
Optimizing Data Caching for iPhone Application Responsiveness
I Phone On Rails
Integrating Push Notifications in your iPhone application with iLime
Starting Core Animation
P2P Multiplayer Gaming
Using Concurrency To Improve Responsiveness
Leaving Interface Builder Behind
Mobile WebKit Development and jQTouch
Accelerometer and OpenGL
Deep Geek Diving into the iPhone OS and Framework
NSNotificationCenter vs. AppDelegate
Using SQLite
From Flash to iPhone
Ad

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation_ Review paper, used for researhc scholars
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Dropbox Q2 2025 Financial Results & Investor Presentation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)

Introtoduction to cocos2d