November 2019
Beginner
436 pages
8h 52m
English
In this section, we are going to provide keyboard support for our minigame. Our users should be able to use the cursor keys to move the ship in all directions. To access the state of the keyboard keys, we need a global variable to hold the state of the pressed keys. Let's learn how to do this:
const game = new Phaser.Game(config); let cursors;
// Create cursors cursors = this.input.keyboard.createCursorKeys();
According to the official documentation, this creates a new object called cursors. It contains four objects: ...
Read now
Unlock full access