summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-02-28 08:49:12 +0800
committerEltrac <hi@guhub.cn>2025-02-28 08:49:12 +0800
commited16d45e9e42042054c10a287932e62fb77d5d3f (patch)
treeb311ebb74cf03e1442c4f28604072736f23c073e /main.lua
parent240208c0e00d51beaea3b58d30ba17f981443323 (diff)
refactor: separate controller logic
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.lua b/main.lua
index a9dfdd3..6628645 100644
--- a/main.lua
+++ b/main.lua
@@ -48,8 +48,14 @@ function love.load()
initGame()
end
+function love.draw()
+ renderer:draw()
+end
+
+local controller = require "logic.controller"
+
function love.update(dt)
- local updates = { player, enemies, bullets, loot, map }
+ local updates = { player, enemies, bullets, loot, map, controller }
for _, entity in ipairs(updates) do
entity.update(dt)
end
@@ -61,10 +67,6 @@ function love.update(dt)
G.time = G.time + dt
end
-function love.draw()
- renderer:draw()
-end
-
function love.keypressed(key)
- player.keypressed(key)
+ controller.keypressed(key)
end