Update storeInput function

This commit is contained in:
SweetSea-ButImNotSweet
2024-05-17 16:33:30 +07:00
parent 8c895221bd
commit 64f85ae4e9

View File

@@ -289,16 +289,25 @@ end
function GameMode:storeInput(input_set) function GameMode:storeInput(input_set)
self.recorded_inputs[self.frames] = bit.bor( local input_code_list = {
input_set['right'] and 1 or 0, right = 1 ,
input_set['rotate_right2'] and 2 or 0, rotate_right2 = 2 ,
input_set['up'] and 4 or 0, up = 4 ,
input_set['rotate_left'] and 8 or 0, rotate_left = 8 ,
input_set['left'] and 16 or 0, left = 16 ,
input_set['down'] and 32 or 0, down = 32 ,
input_set['rotate_right'] and 64 or 0, rotate_right = 64 ,
input_set['rotate_left2'] and 128 or 0 rotate_left2 = 128,
) }
local current_frame_input = 0
for key, code in pairs(input_code_list) do
if input_set[key] then
current_frame_input = bit.bor(current_frame_input, code)
end
end
self.recorded_inputs[self.frames] = current_frame_input
end end
function GameMode:getReplayInputs(input_file) function GameMode:getReplayInputs(input_file)
local i = 1 local i = 1