summaryrefslogtreecommitdiff
path: root/logic/controller.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-13 20:15:40 +0800
committerEltrac <hi@guhub.cn>2025-03-13 20:15:40 +0800
commitcf1ce9c40716da7883cde90633453aaa82fa9a45 (patch)
treece0edefe4af7cbbd0373f9a4e99aefaa7a0a79cb /logic/controller.lua
parentc80deca77394890e4083724b7d29fea4e54b6be4 (diff)
feat: player now can click right to punch mobs
Diffstat (limited to 'logic/controller.lua')
-rw-r--r--logic/controller.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/logic/controller.lua b/logic/controller.lua
index 84cf0ee..eb9cb20 100644
--- a/logic/controller.lua
+++ b/logic/controller.lua
@@ -50,6 +50,10 @@ local function playerClickMouseToShoot(dt)
end
end
+local function playerClickMouseToPunch(x, y)
+ G.player:punch({ x = x, y = y})
+end
+
-- entry functions
-- controller that needs constant press check
@@ -63,4 +67,10 @@ function controller.keypressed(key)
playerPressKeysToArrangeHearts(key)
end
+function controller.mousereleased(x, y, button)
+ if button == 2 then
+ playerClickMouseToPunch(x, y)
+ end
+end
+
return controller