Cocos2D Key Features

Still unsure if Cocos2D is right for you? Well, check out some of these amazing fea-
tures of Cocos2D that can make developing your next game a lot easier.
Actions
Actions are one of the most powerful features in Cocos2D. Actions allow you to move, scale, and manipulate sprites and other objects with ease. As an example, to
smoothly move a space cargo ship across the screen 400 pixels to the right in 5 seconds, all the code you need is:
       CCAction *moveAction = [CCMoveBy actionWithDuration:5.0f
                                          position:CGPointMake(400.0f,0.0f)];
       [spaceCargoShipSprite runAction:moveAction];
 That’s it; just two lines of code! Figure P.1 illustrates the moveAction on the space cargo ship.
There are many kinds of built-in actions in Cocos2D: rotate, scale, jump, blink, fade, tint, animation, and more. You can also chain actions together and call custom callbacks for neat effects with very little code.


Built-In Font Support
Cocos2D makes it very easy to deal with text, which is important for games in menu systems, score displays, debugging, and more. Cocos2D includes support for embedded TrueType fonts and also a fast bitmap font-rendering system, so you can display text to the screen with just a few lines of code.


An Extensive Effects Library

Cocos2D includes a powerful particle system that makes it easy to add cool effects such as smoke, fire, rain, and snow to your games. Also, Cocos2D includes built-in effects,  such as f lip and fading, to transition between screens in your game.


Great for TileMap Games

Cocos2D includes built-in support for tile-mapped games, which is great when you have a large game world made up of small reusable images. Cocos2D also makes it easy to move the camera around to implement scrolling backgrounds or levels. Finally,  there is support for parallax scrolling, which gives your game the illusion of 3D depth and perspective.


Audio/Sound Support
The sound engine included with Cocos2D allows for easy use of the power of OpenAL without having to dive into the lower level APIs. With Cocos2D’s sound engine, you can play background music or sound effects with just a single line of code!


 Two Powerful Physics Engines

 Also bundled with Cocos2D are two powerful physics engines, Box2D and Chipmunk,  both of which are fantastic for games. You can add a whole new level of realism to  your games and create entire new gameplay types by using game physics—without  having to be a math guru.


你可能感兴趣的:(Cocos2D Key Features)