We need energy to build the buildings. In this task, we generate energy for each satellite built on the board.
Before we start this task, we need to revert the game parameters that we temporarily changed in the previous section. In the
game.js file, we set the initial lives to
20 and the energies to
game.lives = 20; game.energies = 120;
We have the new display object, an energy bubble, which can be collected when it is generated by satellites. Add the
energy.js file to the
board-objects folder and include it into the HTML:
Let's work on energy generation:
assets.jsfile, but we will add more logic to the ...