SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie Introtoduction to cocos2d

Introduction to-cocos2d
Introduction to-cocos2dIntroduction to-cocos2d
Introduction to-cocos2d
sagaroceanic11
 
Talk About Configuration Management
Talk About Configuration ManagementTalk About Configuration Management
Talk About Configuration Management
Guixing Bai
 

Ähnlich wie Introtoduction to cocos2d (20)

Introduction to Cocos2d
Introduction to Cocos2dIntroduction to Cocos2d
Introduction to Cocos2d
 
Introduction to-cocos2d
Introduction to-cocos2dIntroduction to-cocos2d
Introduction to-cocos2d
 
Nodes Cck And Panels
Nodes Cck And PanelsNodes Cck And Panels
Nodes Cck And Panels
 
All The Little Pieces
All The Little PiecesAll The Little Pieces
All The Little Pieces
 
Strategies Tech It Up
Strategies Tech It UpStrategies Tech It Up
Strategies Tech It Up
 
Testing In Agile
Testing In AgileTesting In Agile
Testing In Agile
 
Processing
ProcessingProcessing
Processing
 
Plugin Testing
Plugin TestingPlugin Testing
Plugin Testing
 
Addictive Websites
Addictive WebsitesAddictive Websites
Addictive Websites
 
Wolkomir Project Colman 2010
Wolkomir Project Colman 2010Wolkomir Project Colman 2010
Wolkomir Project Colman 2010
 
How OpenNTF Open Source Solutions Can Save You Time, Money And Your Hair
How OpenNTF Open Source Solutions Can Save You Time, Money And Your HairHow OpenNTF Open Source Solutions Can Save You Time, Money And Your Hair
How OpenNTF Open Source Solutions Can Save You Time, Money And Your Hair
 
BDW: How To Pitch Your Ideas
BDW: How To Pitch Your IdeasBDW: How To Pitch Your Ideas
BDW: How To Pitch Your Ideas
 
Talk About Configuration Management
Talk About Configuration ManagementTalk About Configuration Management
Talk About Configuration Management
 
Making Design By Committee Work
Making Design By Committee WorkMaking Design By Committee Work
Making Design By Committee Work
 
Noit ocon-2010
Noit ocon-2010Noit ocon-2010
Noit ocon-2010
 
Open Source Tools For Freelancers
Open Source Tools For FreelancersOpen Source Tools For Freelancers
Open Source Tools For Freelancers
 
Splash
SplashSplash
Splash
 
Plone on Amazon EC2
Plone on Amazon EC2Plone on Amazon EC2
Plone on Amazon EC2
 
Better Quality through Scrum
Better Quality through ScrumBetter Quality through Scrum
Better Quality through Scrum
 
Drizzle - Status, Principles and Ecosystem
Drizzle - Status, Principles and EcosystemDrizzle - Status, Principles and Ecosystem
Drizzle - Status, Principles and Ecosystem
 

Mehr von John Wilker

Mehr von John Wilker (20)

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

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Introtoduction to cocos2d