Posted January 07, 2025 by Kehvarl
After reviewing the "Save/Load/Game" sample from https://docs.dragonruby.org/#/samples/save-load?id=save-load-game-mainrb I have revisited my button approach. Buttons themselves are simpler now, basically just hashes, and all the functionality lives in the game class.
I've also tried splitting the actual game logic out from the engine logic by subclassing Game for the actual game and hiding all the boilerplate in the parent class.
The Produce! button generates Resource when clicked if it's full.
The Defend! button counts down to 0. Clicking it resets the countdown. If it makes it to 0, that button is destroyed.