Monday, January 4, 2021

Live & Learn

I was overjoyed to find a clean approach to a pause function

in the Breakout game code. My clumsy attempt to define one

in the Flappy Bird assignment left me forced to test for pause

in the update function. The right way to do it - entirely in the

PlayState update - kicks off with paused as true, otherwise return.

Moreover, I had to use 'enter' to go back to the game. Here, a new

tap on 'space' does the trick.

Neat!




*     *     *

The love2d entry on local function is also worth reading. Comes down
to the fact that global functions are stored in a table while local ones
are in the stack.


https://love2d.org/wiki/local



No comments: