I’m wondering how to make changes to variables such as input handlers outside the gaming loop.
I’m a novice programmer. From how I see things once playdate.update() starts to run and changes I want to make would be there but that often I don’t want to make changes 30 times per second. Is there a simple solution to this?
It’s been a barrier to me making things and has been an issues with scene changes as well.
Check out the "A Basic Playdate Game in Lua" in the Inside Playdate docs, and the Examples folder that comes with the SDK contains many samples from simple to full games.
But there are many alternative approaches.
Anything that comes before playdate.update() will run before it. If you assign it to a variable you can modify the contents or reassign as your game goes on.
You can use timers to execute things on a schedule. The most simple version of a timer is having an if-statement that tests whether the current time modulus your interval is zero, in your update function.
Callbacks will allow one thing to run on the completion of another.