Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to learn "Animations in COCOS2D"

I am new to cocos2d animations and I want to learn it , as always I stops at the point of animation while making iPhone games in cocos2d.

Can any one suggest me the way to learn such animations, so that games animation creating will become easy to make.

Thanks.

like image 528
V.V Avatar asked Jun 10 '10 06:06

V.V


People also ask

Is Cocos2d a game engine?

Cocos2d-x. Cocos2d-x is a mature open source cross-platform game development framework that supports 2D and 3D game creation. The engine provides rich functions such as graphics rendering, GUI, audio, network, physics, user input, etc., and is widely used in game development and interactive application construction.

What is Sprite Cocos2d?

A Sprite is a 2D image that can be animated or transformed by changing its properties, including rotation, position, scale, color, etc.


2 Answers

Seems like there are 2 ways to go - either your sprites are laid out in a regular fashion and so can be picked off the sprite sheet in a programmatic way, like this first example. The other way is to use a tool like Zwoptex to create the sprite sheet and a corresponding plist that tells Cocos2d where to find the images on the sheet, see second example.

Tutorial for getting sprites off a sheet, using a regular layout:

http://getsetgames.com/2010/04/18/how-to-animate-sprites-in-cocos2d/

The basics are:

  1. Get your images into one large image/texture
  2. Create a CCSpriteSheet using that texture
  3. Create a CCSprite using one of the images in your sprite sheet
  4. Create a CCAnimation and populate it with CCSpriteFrame's - each representing a frame in the animation
  5. Create a CCAnimate action to manage showing each frame and run it on sprite, voila.

The alternative is to use a tool like Zwoptex to configure your images on a sheet which will export the sprite sheet and a plist of details of the images on it.

The first third of this tutorial explains it:

http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone

Hope that helps, Chris

like image 84
Chris Kimpton Avatar answered Oct 14 '22 11:10

Chris Kimpton


There are several cocos2d tutorials avaliable around the net. Also take a look at their docs. Another good resource can be github.com where you'll find at least couple of opensource games made in cocos2d

like image 20
dusker Avatar answered Oct 14 '22 09:10

dusker