Update virtual control stuff

This commit is contained in:
SweetSea-ButImNotSweet
2024-04-19 12:53:13 +07:00
parent aefc660dd4
commit cedc6e888e
6 changed files with 96 additions and 81 deletions

View File

@@ -28,29 +28,13 @@ function TrainingScene:new()
rotate_right2=false,
hold=false,
}
self.inputs_waiting2trigger={ -- Used for buffering the input, in case the input is too fast (1f)
left=false,
right=false,
up=false,
down=false,
rotate_left=false,
rotate_left2=false,
rotate_right=false,
rotate_right2=false,
hold=false,
}
self.paused = false
end
function TrainingScene:update()
local inputs = {}
for input, value in pairs(self.inputs) do
if self.inputs_waiting2trigger[input] then
inputs[input]=true
self.inputs_waiting2trigger[input]=false
else
inputs[input] = value
end
inputs[input] = value
end
self.game:update(inputs, self.ruleset)
self.game.grid:update()
@@ -67,7 +51,6 @@ function TrainingScene:onInputPress(e)
scene = TitleScene()
elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then
self.inputs[e.input] = true
self.inputs_waiting2trigger[e.input] = true
end
end