usselman / flutter

Endless runner game made in Pico-8 coded in Lua
2 stars 2 forks source link

Encapsulate game events in Game class #1

Closed owenkellogg closed 1 year ago

owenkellogg commented 1 year ago
        var gpio = getP8Gpio();

        const game = new Game({

          gpio,

          onNewScore(score) {
            console.log('New score', { score });
          },

          onStart() {
            console.log('Game started');
            // Post to the API and create a Play in Haste and record it in the database
          },

          onEnd({ score }) {
            console.log('Game ended', { score });

            // Post to API and create Score in Haste and record it in the database
            // Update the Play in the database now that it is complete
          }

        })