Post Pic

Cocos2d a short Explanation PART 1

Hello everybody, several people have asked me how does Cocos2d-iphone works; so today I’m going to talk about what the original Cocos2d was like and how its changed-followed by some equivalencies such as [self addChild: sprite]; etc…

If you need any help go ahead comment below…

Thanks and Enjoy!

The Original:

From- http://cocos2d.org/

“cocos2d is a framework for building 2D games, demos, and other graphical/interactive applications”

  • Built-in Python Interpreter: For debugging purposes
  • BSD License: Just use it
  • Pyglet Based: No external dependencies
  • OpenGL Based: Hardware Acceleration

How its changed..

Since the iPhone uses the Objective C, cocos2d iphone was “ported” to objective c (objc); its based off OpenGL ES 1.1 (hardware acceleration)

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

  • High Score server (Cocos Live)
  • Touch/Accelerometer support
  • Portrait and Landscape mode
  • Integrated Pause/Resume
  • Fast Textures:Supports PVRTC textures, 16-bit textures and 32-bit textures
  • Language: objective-c
  • OpenGL ES 1.1 based

Equivalencies

In cocos2d iPhone the methods are quite similar to the Objective C methods (the names and code just differ)

For an example when you use the code [self addChild: sprite]; you are basically adding a subview, which in the iPhone frameworks the code would be [self addSubview: sprite.view];-this code may be a little more “literal” to some people

Now I am going to go over how some things work…

CCSprite = UIImageView

There are scenes in cocos2d-scenes are comprised of sprites, layer, landscapes, particles, labels, etc

The sprites, particle emitters, labels etc are in a layer-which is in the scene

There is a Director that basically controls everything in cocos2d its known as ccDirector

PART 2: CLICK HERE

Related Posts

  • Cocos2d a short Explanation PART 2
  • Cocos2d Tutorial.. Moving to a Location (Animation)
  • How to Install the Cocos2d API in Xcode!


  • One Response

    [...] Link to part 1! CLICK HERE [...]

    Leave Your Response

    * Name, Email, Comment are Required
    Subscribe via RSS

    Receive the latest iPhone app tutorials and resources delivered to you. Free.

    Latest Tweet



    Follow us on Twitter

    Write for Us

    Get your name in front of the masses by writing for iPhone App Tuts. We will share a plug about you and give links to your site and Twitter page.

    Write for Us

    We need your feedback

    Would you pay a small monthly subscription for consistent iPhone tutorials?

    View Results

    Loading ... Loading ...