O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a JavaScript scripting game

Let's perfect our skills by implementing a game that allows players to use JavaScript. The rules are simple. Each player has a number of entities that move on the board. All entities move in turns; during each turn, the entity can stand still or move to an adjacent tile (cardinally or diagonally). If an entity moves to the tile occupied by another entity, that entity is killed and removed from the board.

At the beginning of the game, all entities are placed randomly on the board. An example of a starting position is displayed on the following image:

Each player must provide a JavaScript function that receives ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required