SlideShare a Scribd company logo
cocos2d                HungryMaster

xionchannel software
cocos2d                HungryMaster

xionchannel software
twitter: @ajinotataki

email: xionchannel@gmail.com


Solid Dots, ElectroMaster,
HungryMaster
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
…
              CCLayer




         CCLayer

CCMenu
http://xionchannel.no-ip.org/
http://xionchannel.no-ip.org/
OverTopLayer
OverTopLayer
OverTopLayer
OverTopLayer
OverTopLayer
OverTopLayer
OverTopLayer
CCScene                 CCLayer



CCScene                 CCLayer



          touch event
CCScene                 CCLayer




CCScene

   LayerBelow

          OverTopLayer
CCScene                 CCLayer




CCScene

   LayerBelow

          OverTopLayer
CCScene   CCLayer
CCScene   CCLayer
CCScene   CCLayer
CCScene                                    CCLayer



+(MainScene*)sceneWithLayerTop:(CCLayer*)layerTop
           layerBelow:(CCLayer*)layerBelow
{

 MainScene *scene = [MainScene node];


   layerTop.tag = kLayerTop;

   layerBelow.tag = kLayerBelow;


   [scene addChild:layerBelow z:0];

   [scene addChild:layerTop z:2];


 return scene;
}
CCLayer




- (BOOL)transitionFadeWithLayer:(CCLayer*)layer
               duration:(ccTime)d;

- (BOOL)transitionFlowerWithLayer:(CCLayer*)layer
                duration:(ccTime)d;
touch event
emFontProportional
emFontProportional
emFontProportional
emFontProportional

plist

                    pngSplitter

        plist



                …
plist
pngSplitter
plist

        →
…

@”This is <B>blue<> and <G>green<>.”
→“This is blue and green.”


- (void) setColor:(ccColor3B)_color;

- (void) setCentering:(CGPoint)center;
- (void) setRighting:(CGPoint)right;

- (BOOL) isHitByPosition:(CGPoint)pos;

- (void) transferAllChildrenToNewParent:(CCNode*)node;
- (void) transferAllChildrenToNewParent:(CCNode*)node
                          z:(int)z;

- (void) runEachNodeWithAction:(id)action;
emScrollLayer
touch moved
- (void)setScrollAreaWithMinPosition:(CGPoint)min
                 maxPosition:(CGPoint)max;


- (void)setVerticalScrollEnable:(BOOL)enable;

- (void)setHorizontalScrollEnable:(BOOL)enable;
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
CGPoint uiViewPos = [myTouch locationInView:[myTouch view]];
CGPoint cocosPos = [[CCDirector sharedDirector] convertToGL:uiViewPos];

//
cocosPos = ccpSub(cocosPos, self.position);

 
if ([nextButton isHitByPosition:cocosPos]) {

 //
}
emMenu

CCMenu

emFontProportional
CCMenu
CCMenuItems



Align




              selector
CCMenu
CCMenu
CCMenu
emFontProportional



NSString *txt[] = {

 @"0:                                  ",

 @"1:                   ",

 @"2: Third Item",

 @"3: 4th Item",
};
for(int i=0; i<4; i++) {

 f = [emFontProportional fontWithText:txt[i]];

 f.position = ccp(size.width/2-80,
              size.height/2-i*32);

 [self addChild:f];

 [menu addItem:f];
}
[menu selectMenuWithNumber:0];
emFontProportional




CGPoint uiViewPos = [myTouch locationInView:[myTouch view]];
CGPoint cocosPos = [[CCDirector sharedDirector]
             convertToGL:uiViewPos];

int num = [menu getHitItemNumberWithPosition:cocosPos];
[selectedNumberText setText:
 [NSString stringWithFormat:@"Selected Number: %d",num]];
+ (emMenu*)menuWithCursor:(CCNode*)tcursor;

- (void)addItem:(id)item;
- (void)addItem:(id)item enable:(BOOL)isEnable;

- (int)getHitItemNumberWithPosition:(CGPoint)pos;
- (int)getHitItemNumberWithPosition:(CGPoint)pos
                withSelection:(BOOL)selection;

- (void)selectMenuWithNumber:(int)num;
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
iPhone
Target Point


ElectroMaster

MMO

emChara
Virtual Pad Relative




emChara
Virtual Pad Fixed
One more thing...
One more thing...
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
iCade

iCade    Bluetooth

KeyDown, KeyUp



SDK
            delegate
iCade

@protocol iCadeEventDelegate <NSObject>

@optional
- (void)stateChanged:(iCadeState)state;
- (void)buttonDown:(iCadeState)button;
- (void)buttonUp:(iCadeState)button;

@end
iCade
typedef enum iCadeState {
   iCadeJoystickNone    = 0x000,
   iCadeJoystickUp     = 0x001,
   iCadeJoystickRight  = 0x002,
   iCadeJoystickDown     = 0x004,
   iCadeJoystickLeft  = 0x008,

  iCadeJoystickUpRight = iCadeJoystickUp | iCadeJoystickRight,
  iCadeJoystickDownRight = iCadeJoystickDown | iCadeJoystickRight,
  iCadeJoystickUpLeft  = iCadeJoystickUp | iCadeJoystickLeft,
  iCadeJoystickDownLeft = iCadeJoystickDown | iCadeJoystickLeft,

  iCadeButtonA       = 0x010,
  iCadeButtonB       = 0x020,
  iCadeButtonC       = 0x040,
  iCadeButtonD       = 0x080,
  iCadeButtonE       = 0x100,
  iCadeButtonF       = 0x200,
  iCadeButtonG       = 0x400,
  iCadeButtonH       = 0x800,

} iCadeState;
iCade
iCadeState s = iCadeControl.iCadeState;
if (s) {

 CGPoint acc = ccp(0,0);

 if (s & iCadeJoystickUp) acc.y = 0.25f;

 if (s & iCadeJoystickDown) acc.y = -0.25f;

 if (s & iCadeJoystickLeft) acc.x = -0.25f;

 if (s & iCadeJoystickRight) acc.x = 0.25f;

 CGPoint vec = ccpMult(ccpNormalize(acc), 40);

 if (acc.x==0 && acc.y==0) {

 
      controlArrowDirection.visible = NO;

 }

 else {

 
      if (controlMethod==kControlVirtualPadFixed) {

 
      
 controlArrowDirection.visible = YES;

 
      
 controlArrowDirection.position =
                           ccpAdd(vec, controlArrow.position);

 
      }

 
      [chara setCharaAccelVector:vec];

 }
}
cocos2d 事例編 HungryMasterの実装から

More Related Content

PDF
Finagle By Twitter Engineer @ Knoldus
PDF
Functional Systems @ Twitter
PDF
Statistics.cpp
PDF
C++ TUTORIAL 4
PDF
Scala.io
PDF
Clojure functions 4
PDF
Gems of GameplayKit. UA Mobile 2017.
PPTX
New presentation oop
Finagle By Twitter Engineer @ Knoldus
Functional Systems @ Twitter
Statistics.cpp
C++ TUTORIAL 4
Scala.io
Clojure functions 4
Gems of GameplayKit. UA Mobile 2017.
New presentation oop

What's hot (20)

PPTX
Patrick Kettner - JavaScript without javascript
PDF
Зависимые типы в GHC 8. Максим Талдыкин
PDF
Nonlinear analysis of frame with hinge by hinge method in c programming
PDF
Nonlinear analysis of braced frame with hinge by hinge method in c programming
PDF
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
PPTX
Javascript Without Javascript
DOCX
Class array
PPT
C questions
DOCX
Experement no 6
PPTX
PDF
Oopsprc1e
DOCX
Conversion of data types in java
PDF
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
PPT
Cpp tutorial
PDF
20090622 Vimm4
TXT
Dvst
TXT
PPTX
Better performance through Superscalarity
PDF
Ooprc4 b
Patrick Kettner - JavaScript without javascript
Зависимые типы в GHC 8. Максим Талдыкин
Nonlinear analysis of frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Javascript Without Javascript
Class array
C questions
Experement no 6
Oopsprc1e
Conversion of data types in java
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Cpp tutorial
20090622 Vimm4
Dvst
Better performance through Superscalarity
Ooprc4 b
Ad

Similar to cocos2d 事例編 HungryMasterの実装から (20)

PDF
cocos2d for i Phoneの紹介
KEY
Cocos2dを使ったゲーム作成の事例
KEY
Cocos2d実践編 1.0.0rc
KEY
Exploring Canvas
PDF
Shootting Game
PDF
Standford 2015 week3: Objective-C Compatibility, Property List, Views
KEY
Core animation
DOCX
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
PDF
303 TANSTAAFL: Using Open Source iPhone UI Code
PDF
Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-
PDF
QML\Qt Quick на практике
PPTX
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
PDF
Is HTML5 Ready? (workshop)
PDF
Is html5-ready-workshop-110727181512-phpapp02
PDF
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
PDF
I need to create a page looks like a picture. But it looks different.pdf
DOCX
C++ file
DOCX
C++ file
PDF
CE344L-200365-Lab5.pdf
PPTX
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
cocos2d for i Phoneの紹介
Cocos2dを使ったゲーム作成の事例
Cocos2d実践編 1.0.0rc
Exploring Canvas
Shootting Game
Standford 2015 week3: Objective-C Compatibility, Property List, Views
Core animation
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
303 TANSTAAFL: Using Open Source iPhone UI Code
Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-
QML\Qt Quick на практике
Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019
Is HTML5 Ready? (workshop)
Is html5-ready-workshop-110727181512-phpapp02
203 Is It Real or Is It Virtual? Augmented Reality on the iPhone
I need to create a page looks like a picture. But it looks different.pdf
C++ file
C++ file
CE344L-200365-Lab5.pdf
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Ad

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
KodekX | Application Modernization Development
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KodekX | Application Modernization Development
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf

cocos2d 事例編 HungryMasterの実装から

Editor's Notes