SlideShare ist ein Scribd-Unternehmen logo
1 von 30
cocos2d for iPhone
• cocos2d       iPhone&iPad
• cocos2d
  –
  –
  – RPG
•
• Game Center
•
•
•
cocos2d for iPhone
• 2D
• Objective-C
•
•
  – MIT
    •     OK    OK
cocos2d
•
•
•
    –
    – OpenGL
•
    –
    –
    –
•
    –
    –
    –
•
    –
•
    –
    –
//
CCScene* scene = [CCScene node];
//
CCLayer* background = [MyBGLayer node];
[scene addChild: background];
CCLayer* mainlayer = [MyMainLayer node];
[scene addChild: mainlayer];
//
//                     (0,0)
CCSprite* playersprite =
     [CCSprite spriteWithFile:@”Player.png”];
[mainlayer addChild: playersprite];
• Parallax
•
•
  →
//
CCParallaxNode* paraNode =
                      [CCParallaxNode node];
[paraNode addChild:spriteSky z:1
     parallaxRatio:CGPointMake(0.5f, 0)
     positionOffset:topOffset];
[paraNode addChild:spriteMountain z:2
     parallaxRatio:CGPointMake(1, 0)
     positionOffset:midOffset];
[paraNode addChild:spriteTree z:4
     parallaxRatio:CGPointMake(3, 0)
     positionOffset:downOffset];
•

•

•

•

•
//                 (100,200) 3
CCMoveTo* move = [CCMoveTo actionWithDuration:3
                             position:CGPointMake(100,200)];
[myNode runAction:move];
//
CCMoveTo* move = [CCMoveTo actionWithDuration:3
                             position:CGPointMake(100,200)];
CCEaseInOut* ease = [CCEaseInOut actionWithAction:move rate:4];
[myNode runAction:ease]
//
CCRotateBy* rotateBy = [CCRotateBy actionWithDuration:2
                                 angle:360];
//
CCRepeatForever* repeat = [CCRepeatForever
                                   actionWithAction:rotateBy];
[myNode runAction:repeat];
//
CCSequence* sequence = [CCSequence actions: at1, at2, at3, nil];
[myNode runAction:sequence];
•

•
    http://www.youtube.com/watch
    ?v=zMCKQl5uSYw
•

•
•
Particle Designer($7.99)
//               plist
CCParticleSystem* particle =
[CCParticleSystemQuad
    particleWithFile:@”particle1.plist”];

//
CGSize winSize = [[CCDirector sharedDirector]
winSize];
particle.position = CGPointMake( winSize.width
/ 2, winSize.height / 2 );
[myLayer addChild:particle z:1 tag:1];
• 1
•
•
Zwoptex
•

    plist
•
//                       plist
CCSpriteFrameCache* frameCache =
[CCSpriteFrameCache
sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:
     @”texture-atlas1.plist”];
//

CCSpriteFrame* sprite = [frameCache
spriteFrameByName:@”sprite1.png”];
•
•
    –
•
Tiled Map Editor
//
CCTMXTiledMap* tileMap = [CCTMXTiledMap
tiledMapWithFile:@”tilemap.tmx”];
[myLayer addChild:tileMap z:-1 tag:1]
• box2d chipmunk
•
•

• box2d C++
  chipmunk C
•
•
•

//
[[CCDirector sharedDirector] pause];
//
[[CCDirector sharedDirector] resume];
•


•       cocos2d
    –
cocos2d
1. main appDelegate

2. appDelegate
  1. EAGLView
  2. Director
     [Direcotor sharedDirector];
     EAGLView      director
  3.                         runWithScene
     [director runWithScene: firstScene];
     ※
     scene
•       Layer
• Layer                                CCTouchDispatcher

•                                               UIKit

    [[CCDirector sharedDirector] convertToGL:touchLocation];
// Layer
self.isTouchEnabled = YES;
self.isAccelerometerEnabled = YES;
// Layer

-(void) ccTouchesBegan: (NSSet *)touches withEvent:(UIEvent *)event
-(void) accelerometer:(UIAccelerometer *)accelerometer
didAccelerate:(UIAcceleration *)acceleration
•            update
    –1     60         1
     update 60
•      update
• n
// update
[self scheduleUpdate];
-(void) update:(ccTime)delta {
      //
}
// interval     update
[self schedule:@selector(myUpdate1:)
interval :0.1f];
-(void) myUpdate1:(ccTime)delta {
      // 0.1
}
#import “SimpleAudioEngine.h”
[[SimpleAudioEngine sharedEngine]
   playBackgroundMusic:@”bgm.mp3” loop:YES]
[[SimpleAudioEngine sharedEngine]
   playEffect:@”se01.caf”];

※                            mp3
cocos2d
           iPhone&iPad

•

    –

    –

    –

•
• amazon

Weitere ähnliche Inhalte

Ähnlich wie Cocos2d game development for iPhone

203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhonejonmarimba
 
Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Yuichi Higuchi
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸Hao Peiqiang
 
Creating physics game in 1 hour
Creating physics game in 1 hourCreating physics game in 1 hour
Creating physics game in 1 hourLinkou Bian
 
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装からcocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装からYuichi Higuchi
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2dVinsol
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Chris Adamson
 
Keeping Track of Moving Things: MapKit and CoreLocation in Depth
Keeping Track of Moving Things: MapKit and CoreLocation in DepthKeeping Track of Moving Things: MapKit and CoreLocation in Depth
Keeping Track of Moving Things: MapKit and CoreLocation in DepthGeoffrey Goetz
 
Cocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rcCocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rcYuichi Higuchi
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаГлеб Тарасов
 
CCSendMessages introduction
CCSendMessages introductionCCSendMessages introduction
CCSendMessages introductionKeisuke Hata
 
Demo creating-physics-game.
Demo creating-physics-game.Demo creating-physics-game.
Demo creating-physics-game.sagaroceanic11
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Jorge Maroto
 
iOS 2D Gamedev @ CocoaHeads
iOS 2D Gamedev @ CocoaHeadsiOS 2D Gamedev @ CocoaHeads
iOS 2D Gamedev @ CocoaHeadsAlain Hufkens
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 

Ähnlich wie Cocos2d game development for iPhone (20)

Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014Cocos2d 소개 - Korea Linux Forum 2014
Cocos2d 소개 - Korea Linux Forum 2014
 
Core animation
Core animationCore animation
Core animation
 
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
 
Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
 
Creating physics game in 1 hour
Creating physics game in 1 hourCreating physics game in 1 hour
Creating physics game in 1 hour
 
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装からcocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
 
Shootting Game
Shootting GameShootting Game
Shootting Game
 
Cocos2d for beginners
Cocos2d for beginnersCocos2d for beginners
Cocos2d for beginners
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
 
Keeping Track of Moving Things: MapKit and CoreLocation in Depth
Keeping Track of Moving Things: MapKit and CoreLocation in DepthKeeping Track of Moving Things: MapKit and CoreLocation in Depth
Keeping Track of Moving Things: MapKit and CoreLocation in Depth
 
Cocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rcCocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rc
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
 
CCSendMessages introduction
CCSendMessages introductionCCSendMessages introduction
CCSendMessages introduction
 
Demo creating-physics-game.
Demo creating-physics-game.Demo creating-physics-game.
Demo creating-physics-game.
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)
 
iOS 2D Gamedev @ CocoaHeads
iOS 2D Gamedev @ CocoaHeadsiOS 2D Gamedev @ CocoaHeads
iOS 2D Gamedev @ CocoaHeads
 
CakePHP in iPhone App
CakePHP in iPhone AppCakePHP in iPhone App
CakePHP in iPhone App
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 

Kürzlich hochgeladen

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 2024The Digital Insurer
 
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 Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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 RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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 productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
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 organizationRadu Cotescu
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Kürzlich hochgeladen (20)

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
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Cocos2d game development for iPhone

  • 2. • cocos2d iPhone&iPad • cocos2d – – – RPG • • Game Center • • •
  • 3. cocos2d for iPhone • 2D • Objective-C • • – MIT • OK OK
  • 5. – – OpenGL • – – – • – – – • –
  • 6. – –
  • 7. // CCScene* scene = [CCScene node]; // CCLayer* background = [MyBGLayer node]; [scene addChild: background]; CCLayer* mainlayer = [MyMainLayer node]; [scene addChild: mainlayer]; // // (0,0) CCSprite* playersprite = [CCSprite spriteWithFile:@”Player.png”]; [mainlayer addChild: playersprite];
  • 9. // CCParallaxNode* paraNode = [CCParallaxNode node]; [paraNode addChild:spriteSky z:1 parallaxRatio:CGPointMake(0.5f, 0) positionOffset:topOffset]; [paraNode addChild:spriteMountain z:2 parallaxRatio:CGPointMake(1, 0) positionOffset:midOffset]; [paraNode addChild:spriteTree z:4 parallaxRatio:CGPointMake(3, 0) positionOffset:downOffset];
  • 11. // (100,200) 3 CCMoveTo* move = [CCMoveTo actionWithDuration:3 position:CGPointMake(100,200)]; [myNode runAction:move]; // CCMoveTo* move = [CCMoveTo actionWithDuration:3 position:CGPointMake(100,200)]; CCEaseInOut* ease = [CCEaseInOut actionWithAction:move rate:4]; [myNode runAction:ease] // CCRotateBy* rotateBy = [CCRotateBy actionWithDuration:2 angle:360]; // CCRepeatForever* repeat = [CCRepeatForever actionWithAction:rotateBy]; [myNode runAction:repeat]; // CCSequence* sequence = [CCSequence actions: at1, at2, at3, nil]; [myNode runAction:sequence];
  • 12. • • http://www.youtube.com/watch ?v=zMCKQl5uSYw • • •
  • 14. // plist CCParticleSystem* particle = [CCParticleSystemQuad particleWithFile:@”particle1.plist”]; // CGSize winSize = [[CCDirector sharedDirector] winSize]; particle.position = CGPointMake( winSize.width / 2, winSize.height / 2 ); [myLayer addChild:particle z:1 tag:1];
  • 16. Zwoptex • plist •
  • 17. // plist CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache]; [frameCache addSpriteFramesWithFile: @”texture-atlas1.plist”]; // CCSpriteFrame* sprite = [frameCache spriteFrameByName:@”sprite1.png”];
  • 18. • • – •
  • 20. // CCTMXTiledMap* tileMap = [CCTMXTiledMap tiledMapWithFile:@”tilemap.tmx”]; [myLayer addChild:tileMap z:-1 tag:1]
  • 21. • box2d chipmunk • • • box2d C++ chipmunk C
  • 23. • • cocos2d –
  • 24. cocos2d 1. main appDelegate 2. appDelegate 1. EAGLView 2. Director [Direcotor sharedDirector]; EAGLView director 3. runWithScene [director runWithScene: firstScene]; ※ scene
  • 25. Layer • Layer CCTouchDispatcher • UIKit [[CCDirector sharedDirector] convertToGL:touchLocation];
  • 26. // Layer self.isTouchEnabled = YES; self.isAccelerometerEnabled = YES; // Layer -(void) ccTouchesBegan: (NSSet *)touches withEvent:(UIEvent *)event -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
  • 27. update –1 60 1 update 60 • update • n
  • 28. // update [self scheduleUpdate]; -(void) update:(ccTime)delta { // } // interval update [self schedule:@selector(myUpdate1:) interval :0.1f]; -(void) myUpdate1:(ccTime)delta { // 0.1 }
  • 29. #import “SimpleAudioEngine.h” [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@”bgm.mp3” loop:YES] [[SimpleAudioEngine sharedEngine] playEffect:@”se01.caf”]; ※ mp3
  • 30. cocos2d iPhone&iPad • – – – • • amazon