Learning Cocos2d-JS Game Development
上QQ阅读APP看书,第一时间看更新

Chapter 2. Adding Interactivity – The Making of a Concentration Game

By definition, a game is interactive in some way. Players have to be part of it by doing things. The simplest form of interactivity is clicking or touching tiles in the game.

A Concentration game is simple to explain, but it will cover some new and important concepts, such as:

  • Creating multiple instances of game assets
  • Extending classes to improve its capabilities. Actually, there are no classes in JavaScript, but they are emulated using variables and prototypes
  • Adding gradients
  • Making assets react to clicks and touches
  • Changing sprite images on the fly
  • Adding text labels
  • Removing sprites from the game

By the end of the chapter, you will be able to create a full Concentration game using space for customization.

As the project created in the previous chapter is more than just a Hello World game and rather acts as a blueprint for all your future projects, you'll start building our Concentration game out of the previously finished project.