Difference between standard and delay timers?

What is the difference between playdate.timer.new and playdate.timer.performAfterDelay? The documentation seems to describe the same behavior. Do they have different semantics?

1 Like

The code for these is in CoreLibs so you can read it yourself:

  • PlaydateSDK/CoreLibs/timer.lua

playdate.timer.new(duration, callback, …)

  • example use: counting seconds for display on a "stopwatch" timer

the next one is a common use of the above so gets its own method name to make your code more readable. internally it calls the above.

playdate.timer.performAfterDelay(delay, callback, …​)

  • example use: changing enemy boss behaviour after 60 seconds

...I hope that helps!

1 Like

I believe playdate.timer.performAfterDelay() is simply a shorthand to make your code more readable.

@matt the timer of performAfterDelay will start immediately like playdate.timer.new()

1 Like

Thanks Nic have removed superfluous text in my reply.