Advancing the construction progress over time
We have placed some building constructions on the floor in the previous task. In this task, we advance the construction progress over time.
Prepare for lift off
We have the following two images to represent two steps of the building construction. Let's add them to the project's images
folder.
We defined BuildingsData
in the previous task. Now, we add one more parameter to each building's data. The new parameter is the duration in seconds that each construction step takes:
game.BuildingsData['CoinsGenerator'] = { ... // existing building data goes here. stepsSeconds: [10, 20] }; game.BuildingsData['PowerSupply'] = { ... // existing building data goes here. stepsSeconds: [5, 10] }; game.BuildingsData['Merchant'] = { // existing building data goes here. stepsSeconds: [20, 40] };
We added two images and now we insert the following code inside the sprite-view.js
file to make it available for the...