Implement the States for the Game

Understand and implement the different states in our game logic.

Introduction

In this game, we are going to use many concepts and implementations from the Phaser library that we discussed in the Introduction to Phaser.js lesson. To implement this game, we'll be using different states, several tile sprites, various physics concepts to move the objects, and so on. But before all of that, we need to create all the game states and the initialization logic for our game. Let's start by creating a function that will be called every time the web page is loaded.

Create the game states

We'll create a function and set it to the onload ...