gameplay prototype

This commit is contained in:
wooshings
2026-09-26 20:48:09 -07:00
parent 480501a6b6
commit f453d0b1bf
4 changed files with 107 additions and 13 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import rl "vendor:raylib"
Timer :: struct {
lifetime: f32,
callback: proc(),
}
timers: [dynamic]Timer
start_timer :: proc(time: f32, callback: proc()) {
new_timer := Timer {
lifetime = time,
callback = callback,
}
append(&timers, new_timer)
}
run_timers :: proc() {
for &t, i in timers {
t.lifetime -= rl.GetFrameTime()
if t.lifetime <= 0 {
unordered_remove(&timers, i)
t.callback()
}
}
}