Fix virtual button method

This commit is contained in:
SweetSea-ButImNotSweet
2024-05-27 20:18:24 +07:00
parent 5cc3cae343
commit 7cf450868a
4 changed files with 9 additions and 4 deletions

View File

@@ -45,6 +45,8 @@ local buttonList = {
local menuKey -- MENU key used to go main menu XD
function GameScene:new(player_name, replay_file, replay_grade)
VCTRL[9].show = false
menuKey = BUTTON.new{
text = "MENU",
x = 265, y = 0, w = 60, h = 25,
@@ -130,7 +132,7 @@ end
function GameScene:onInputPress(e)
if e.type == "mouse" or (e.type == "touch" and not VCTRL.press(e.x, e.y, e.id)) then
BUTTON.press(buttonList, e.x, e.y, e.id)
if self.game.input_playback then BUTTON.press(buttonList, e.x, e.y, e.id) end
menuKey:press(e.x, e.y, e.id)
elseif (self.game.game_over or self.game.completed) and (e.input == "menu_decide" or e.input == "menu_back" or e.input == "rotate_right") and self.game.game_over_frames > 50 then
SCENE = TitleScene()
@@ -171,7 +173,7 @@ end
function GameScene:onInputRelease(e)
if e.type == "mouse" or (e.type == "touch" and not VCTRL.release(e.id)) then
BUTTON.release(buttonList, e.x, e.y, e.id)
if self.game.input_playback then BUTTON.release(buttonList, e.x, e.y, e.id) end
menuKey:release(e.x, e.y, e.id)
elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then
self.inputs[e.input] = false