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

Chapter 3. Moving Sprites Around the Screen – An Endless Runner

A while ago, endless runners started with a game called Helicopter where you had to drive a helicopter through an endless cave, just pressing a button to give it thrust.

Then, games became more complex until mobile gaming started to spread. Endless runners started gaining a new popularity due to their simple one tap control. The player is just required to touch anywhere when needed to control a helicopter.

In this chapter, you are going to build an endless runner that features a spaceship flying through a city while avoiding dangerous asteroids.

In the making of this game, you will learn, among other things, how to:

  • Scroll big images to give an idea on an endless background

  • Schedule events

  • Control a frame rate

  • Check collision between sprites

  • Create a simple particle system

  • Move sprites manually or using actions

Moreover, although this is supposed to be a cross-platform game, you will also learn about mouse-only controls. It will be easy...