Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

Creating sprite frame animations


You may have noticed that there are three assets for the bird. These will be used to create a keyframe animation that will run in a loop. SpriteBuilder makes this process very simple:

  1. Create a new file that uses a sprite as its root object. Call it Bird.

  2. Select CSprite in the editor.

  3. In the options pane on the right-hand side of the screen, there is an option for Sprite frame. Set it to bird0.png.

  4. Now, in order to create the animation, select all the bird images in the resources pane on the left of the screen. Right-click on them and select Create keyframes from Selection.

  5. Notice that there has been three keyframes created in the timeline editor. If you click play, you will notice that the bird quickly flaps and then gets stuck on the last frame while the rest of the timeline plays out.

  6. In order to fix this, you need to set the timeline duration. Open the options for the default timeline and select Set timeline duration. Enter 0 seconds and 3 frames.

  7. You also have...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image