Steps

Next Steps


From here, you can continue to add features to the game. You can add other enemies, additional objects, or gameplay features. You can also continue to add levels with different setups.

Let’s add a third level to see how this would work.

Optional Step — Add a third level to the Game With Your Own Preferences

All of the game mechanics should already be in place. We simply need to add the data for the objects in the new level by setting up a json file called level3.json in the data directory.

Once complete, we should be able to go to Level 3 and, upon finishing level 3, it should take us back to level 1.

To do this:

  1. Copy the file level2.json.
  2. Right-click on the data directory and select paste.
  3. Rename the file to level3.json by right-clicking on the file and selection Rename.
  4. Play with the data to get the desired level dynamics.
    1. Be aware that this is a JSON file — meaning that the requirements for the text is very specific. Be sure to follow the patterns that are already there or get help online for writing JSON code.
  5. In the Play.ts file, update the LEVEL_COUNT value to 3.
  6. In the Boot.ts file, add this.load.json('level:3', level3); — make sure to add the import as well: import level3 from '../data/level3.json';

Now, if you play the game you can move on to Level 3. Once completing Level 3, it should take you back to Level 1.

Continue to build the game however you would like.

There are an infinite amount of additions you can make and this tutorial should cover most of the foundational processes for how to make the game work as you continue to build it.

< Back Home