Book Image

Learning Cocos2d-JS Game Development

By : Emanuele Feronato
Book Image

Learning Cocos2d-JS Game Development

By: Emanuele Feronato

Overview of this book

Table of Contents (18 chapters)
Learning Cocos2d-JS Game Development
Credits
Foreword
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
9
Creating Your Own Blockbuster Game – A Complete Match 3 Game
Index

Loading graphic assets


Needless to say, the first thing you should do is place your graphic assets in the assets folder, but there is something new about this step.

In previous examples, we always filled our assets folder with one PNG image for each game actor—the spaceship and asteroid had their own image. This also applies for all Concentration tiles and so on.

Cocos2d-JS has no problems in dealing with multiple images, but as a golden rule, remember the less images you have to deal with, the better your game performs.

So, where's the trick? In order to have a spaceship and an asteroid, you would think you have to load a spaceship image and an asteroid image, but there's another better way to do it, using sprite sheets.

A sprite sheet is a single image made by combining various small images into it. If you are in to web designing, they are called CSS sprites, and if you have already made some native iOS applications, they are called texture atlases.

Does this mean that you have to manually...