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

Hey, like this post? Why not share it with a buddy?

Related Posts

  • Cocos2d a Short Explanation PART 2
  • Cocos2d Tutorial.. Moving to a Location (Animation)
  • Leave a Comment

    *