diff options
| author | Arslaan Pathan <[email protected]> | 2025-06-15 20:27:31 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2025-06-15 20:27:31 +1200 |
| commit | 3c399d6ea4ad3528f1845944bb6d5b00697d2c0b (patch) | |
| tree | 9f136c5e040a2d853d24fd6974233cc01d6e8ceb /assets/scripts/mainMenu.lua | |
| parent | 5348dbdef1c55c076c8603bad98d20c73085d12b (diff) | |
| download | showdownofthesticks-3c399d6ea4ad3528f1845944bb6d5b00697d2c0b.tar.xz showdownofthesticks-3c399d6ea4ad3528f1845944bb6d5b00697d2c0b.zip | |
Add punch feature + knockback etc, lots of cool shit
Diffstat (limited to 'assets/scripts/mainMenu.lua')
| -rw-r--r-- | assets/scripts/mainMenu.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/assets/scripts/mainMenu.lua b/assets/scripts/mainMenu.lua index 05272af..4854775 100644 --- a/assets/scripts/mainMenu.lua +++ b/assets/scripts/mainMenu.lua @@ -22,6 +22,32 @@ Input = { end } +Timer = { + timers = {} +} + +function Timer.after(delay, callback) + table.insert(Timer.timers, { + time = delay, + action = callback + }) +end + +function Timer.clearAllTimers() + Timer.timers = {} +end + +function Timer.update(dt) + for i = #Timer.timers, 1, -1 do + local t = Timer.timers[i] + t.time = t.time - dt + if t.time <= 0 then + t.action() + table.remove(Timer.timers, i) + end + end +end + function Setup() setBgImage("assets/backgrounds/city-background-1.png") end |
