diff options
-rw-r--r-- | conf.lua | 2 | ||||
-rw-r--r-- | lib/main.fnl | 29 | ||||
-rw-r--r-- | lib/player.fnl | 4 |
3 files changed, 20 insertions, 15 deletions
diff --git a/conf.lua b/conf.lua index 233df48..b2439e8 100644 --- a/conf.lua +++ b/conf.lua @@ -1,7 +1,7 @@ function love.conf(t) t.window.resizable = true t.window.title = "soko" - t.window.vsync = 1 + t.window.vsync = 0 t.window.msaa = 1 t.version = "11.3" end diff --git a/lib/main.fnl b/lib/main.fnl index bc3be16..8185f10 100644 --- a/lib/main.fnl +++ b/lib/main.fnl @@ -50,18 +50,23 @@ (table.remove messages i) (set v.ticks (- v.ticks 1)))))) -(fn love.update [] - (music.pre-update) - ;; TODO: make state changes actually possible - (match (pcall #(state.update the-state)) - (true next) (global the-state next) - (true nil) nil - (false x) (do - (print (.. "update: \n" x)) - (table.insert messages - {:ticks 1 - :msg (.. "update: \n" x)}))) - (music.update)) +(var dt-acc 0) + +(fn love.update [dt] + (set dt-acc (math.min (/ 20) (+ dt-acc dt))) + (while (> dt-acc (/ 60)) + (set dt-acc (- dt-acc (/ 60))) + (music.pre-update) + ;; TODO: make state changes actually possible + (match (pcall #(state.update the-state)) + (true next) (global the-state next) + (true nil) nil + (false x) (do + (print (.. "update: \n" x)) + (table.insert messages + {:ticks 1 + :msg (.. "update: \n" x)}))) + (music.update))) (fn love.mousepressed [x y button] (match (pcall #(state.mousepressed the-state x y button)) diff --git a/lib/player.fnl b/lib/player.fnl index d40e980..d10fe81 100644 --- a/lib/player.fnl +++ b/lib/player.fnl @@ -23,8 +23,8 @@ ;; (set self.direction (% (- self.direction 0.1) (* math.pi 2))) (when controls.right (set self.target-spin (+ self.target-spin 0.15))) - (set self.direction (% (+ self.direction (* self.target-spin 0.1)) (* math.pi 2))) - (set self.target-spin (* self.target-spin 0.9)) + (set self.direction (% (+ self.direction (* self.target-spin 0.2)) (* math.pi 2))) + (set self.target-spin (* self.target-spin 0.8)) (set music-state.forward controls.up) (when controls.up (local v (entity.velocity self)) |