diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-13 20:15:40 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-13 20:15:40 +0800 |
| commit | cf1ce9c40716da7883cde90633453aaa82fa9a45 (patch) | |
| tree | ce0edefe4af7cbbd0373f9a4e99aefaa7a0a79cb /logic/controller.lua | |
| parent | c80deca77394890e4083724b7d29fea4e54b6be4 (diff) | |
feat: player now can click right to punch mobs
Diffstat (limited to 'logic/controller.lua')
| -rw-r--r-- | logic/controller.lua | 10 |
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 |
