mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update storeInput function
This commit is contained in:
@@ -289,16 +289,25 @@ end
|
||||
|
||||
|
||||
function GameMode:storeInput(input_set)
|
||||
self.recorded_inputs[self.frames] = bit.bor(
|
||||
input_set['right'] and 1 or 0,
|
||||
input_set['rotate_right2'] and 2 or 0,
|
||||
input_set['up'] and 4 or 0,
|
||||
input_set['rotate_left'] and 8 or 0,
|
||||
input_set['left'] and 16 or 0,
|
||||
input_set['down'] and 32 or 0,
|
||||
input_set['rotate_right'] and 64 or 0,
|
||||
input_set['rotate_left2'] and 128 or 0
|
||||
)
|
||||
local input_code_list = {
|
||||
right = 1 ,
|
||||
rotate_right2 = 2 ,
|
||||
up = 4 ,
|
||||
rotate_left = 8 ,
|
||||
left = 16 ,
|
||||
down = 32 ,
|
||||
rotate_right = 64 ,
|
||||
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
|
||||
function GameMode:getReplayInputs(input_file)
|
||||
local i = 1
|
||||
|
||||
Reference in New Issue
Block a user