After implementing a producer purchase we need to make sure they do the work!
Each second the producer should give us the amount of gold equal to their
- Add a new field
productionRateto the config object exported from
- Initial value of
productionRateshould equal to 0.
- When the user purchases a new producer, we should increase the global
- Implement and export a handler
handlers.jsthat should call a function
- In the
updateGoldfunction, increment the value of gold by productionRate each time it’s called
startMiningGameset the interval that will call
handleStateChangeonce every second
handleStateChangeshould be a closure and return a function in order to be used in
- Remove the call to
handleKeyPressto avoid accounting issues
If you have any issues with it, you can ask for community help below the post.
Feel free to help others if you’ve already solved the task.