diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-16 15:10:30 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-16 15:10:30 +0800 |
| commit | dfdb1023f6513014fc0f955142d2667d7bda80c9 (patch) | |
| tree | cecb9113f5da747ffe3398701a1dd089bc4697ee /logic/controller.lua | |
| parent | d6a4ca82a3874f2fca58ea7948185d697acf078a (diff) | |
feat(controller): easier bullet management
old approach: press number keys to put specific heart to the end of the line
new approach: press Q or E to move the next bullet index
Diffstat (limited to 'logic/controller.lua')
| -rw-r--r-- | logic/controller.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/logic/controller.lua b/logic/controller.lua index 0159ebd..44867bf 100644 --- a/logic/controller.lua +++ b/logic/controller.lua @@ -7,15 +7,11 @@ function controller.ctrlKeyPressed() return keydown("lgui") or keydown("rgui") or keydown("lctrl") or keydown("rctrl") end -local function playerPressKeysToArrangeHearts(key) - -- rearrange heart sequence with number keys - local i = tonumber(key) - local hearts = G.player.hearts - local length = #hearts - if i ~= nil and hearts[i] then - -- move selected heart to the end - local temp = table.remove(hearts, i) - table.insert(hearts, temp) +local function playerChangeNextBullet(key) + if key == "q" then + G.player.nextBullet = G.player.nextBullet -1 + elseif key == "e" then + G.player.nextBullet = G.player.nextBullet +1 end end @@ -77,7 +73,7 @@ end -- controller that requires one key press function controller.keypressed(key) - playerPressKeysToArrangeHearts(key) + playerChangeNextBullet(key) switchLanguageSetting(key) end |
