From cf1ce9c40716da7883cde90633453aaa82fa9a45 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 13 Mar 2025 20:15:40 +0800 Subject: feat: player now can click right to punch mobs --- logic/controller.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'logic/controller.lua') 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 -- cgit v1.2.3