September 20, 2022


Brief Introduction

Timer, which is usually used in some delayed or repeated logic. For example, when a bomb is encountered, it will delay for 1 second before it explodes, and a certain amount of HP will be restored every 1 second.


Timer Timer.newint delay, function callback, tuple … )
Create a timer object


bool  Loop
Repeat or not
int  Delay
Number of frames to wait before each execution


void Execute()
Immediately execute the callback function and end this timer
void Stop()
Stop timer
void Pause()
Pause timer
void Start()
Start timer

Code example

Write a timer that outputs information circularly, with an interval of 1 second, and stop after 10 seconds

--Create a timer with an interval of 20 frames to execute the output