Book Image

HTML5 Game Development Hotshot

By : Seng Hin Mak, Makzan Makzan (Mak Seng Hin)
Book Image

HTML5 Game Development Hotshot

By: Seng Hin Mak, Makzan Makzan (Mak Seng Hin)

Overview of this book

Table of Contents (15 chapters)
HTML5 Game Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Removing the boxes


In this task, we remove the boxes that we no longer need by using tweens. A box can be removed either when it passes the boundary at the bottom of the game or when the player matches the calculation's result.

Prepare for lift off

We will need two additional files for this task. First, add the circle.png file to the images folder. You can find the images from the code bundle.

We also need the TweenJS library from the CreateJS suite. Download the TweenJS file from the CreateJS code repository (https://github.com/CreateJS/TweenJS/tags) or locate the file from the code bundle.

Copy the tweenjs-0.5.1.min.js file and put it into the vendors folder; the same folder where we put the EaselJS file.

Next, we import the TweenJS library in HTML before we import our game.js file; refer to the following code:

<script src="vendors/tweenjs-0.5.1.min.js"></script>

Engage thrusters

Let's add the following code for the box-removing logic:

  1. First, we work on the falling boundary because...