SlideShare uma empresa Scribd logo
1 de 71
cocos2d                HungryMaster

xionchannel software
cocos2d                HungryMaster

xionchannel software
twitter: @ajinotataki

email: xionchannel@gmail.com


Solid Dots, ElectroMaster,
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;
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;
iPhone
Target Point


ElectroMaster

MMO

emChara
Virtual Pad Relative




emChara
Virtual Pad Fixed
One more thing...
One more thing...
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の実装から

Mais conteúdo relacionado

Mais procurados

Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
OdessaJS Conf
 
Class array
Class arrayClass array
Class array
nky92
 
20090622 Vimm4
20090622 Vimm420090622 Vimm4
20090622 Vimm4
id774
 

Mais procurados (20)

New presentation oop
New presentation oopNew presentation oop
New presentation oop
 
Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
 
Зависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЗависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим Талдыкин
 
Nonlinear analysis of frame with hinge by hinge method in c programming
Nonlinear analysis of frame with hinge by hinge method in c programmingNonlinear analysis of frame with hinge by hinge method in c programming
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 braced frame with hinge by hinge method in c programmingNonlinear analysis of braced 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...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
 
week-5x
week-5xweek-5x
week-5x
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
 
Class array
Class arrayClass array
Class array
 
C questions
C questionsC questions
C questions
 
Experement no 6
Experement no 6Experement no 6
Experement no 6
 
OOXX
OOXXOOXX
OOXX
 
Oopsprc1e
Oopsprc1eOopsprc1e
Oopsprc1e
 
Conversion of data types in java
Conversion of data types in javaConversion of data types in java
Conversion of data types in java
 
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...Critical buckling load geometric nonlinearity analysis of springs with rigid ...
Critical buckling load geometric nonlinearity analysis of springs with rigid ...
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
20090622 Vimm4
20090622 Vimm420090622 Vimm4
20090622 Vimm4
 
Dvst
DvstDvst
Dvst
 
Variables
VariablesVariables
Variables
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through Superscalarity
 

Semelhante a cocos2d 事例編 HungryMasterの実装から

Cocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rcCocos2d実践編 1.0.0rc
Cocos2d実践編 1.0.0rc
Yuichi Higuchi
 
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docxCOMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
COMPAPPABCA49085rFunrAP__Practical Number 9 & 10.docx
TashiBhutia12
 
Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-
Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-
Kinect勉強会 Vol.3 -ぼくのかんがえた最強のNUI-
Gota Kakehi
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
Remy Sharp
 
Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02Is html5-ready-workshop-110727181512-phpapp02
Is html5-ready-workshop-110727181512-phpapp02
PL dream
 
I need to create a page looks like a picture. But it looks different.pdf
I need to create a page looks like a picture. But it looks different.pdfI need to create a page looks like a picture. But it looks different.pdf
I need to create a page looks like a picture. But it looks different.pdf
allurafashions98
 

Semelhante a cocos2d 事例編 HungryMasterの実装から (20)

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

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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...
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

cocos2d 事例編 HungryMasterの実装から

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n