Change special code, add a way to skip keys

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-26 21:30:56 +07:00
parent 4b001cdf57
commit 478a8bf49e
5 changed files with 47 additions and 34 deletions

View File

@@ -85,28 +85,26 @@ function ConfigScene:update() end
function ConfigScene:render()
MainBackground()
if secret_code_used then
drawText(
"Oh WOW! You may play Tromi on TV right now and typed a secret code.\n"..
"To return, an special keybind is automatically set.\n"..
"You can see keybind list below"
, 80, 40, 1000
)
drawText("", 80, 70, 1000)
drawBigText("7 9 3 3 8 7 3 2", 80, 100, 1000)
drawText(
"2 - Up 1 - Rotate left 5 - Confirm selection\n"..
"8 - Right 3 - Rotate right 0 - Back\n"..
"4 - Left 7 - Rotate left 2\n"..
"6 - Down 9 - Rotate right 2", 80, 350, 1000
)
elseif self.first_time then
drawText("Thanks for playing Tromi!", 80, 40, 1000)
drawText("Please begin by configuring your controls:", 80, 70, 1000)
drawBigText(table.concat(secret_code_input, " "), 80, 100, 1000)
else
drawText("Which controls do you want to configure?", 80, 70, 1000)
drawBigText(table.concat(secret_code_input, " "), 80, 100, 1000)
end
if SETTINGS.tvMode then
drawText("TV mode is ON now! Check keybind below", 80, 40, 1000)
drawText("Which controls do you want to configure?", 80, 70, 1000)
drawText(
"2 - Up 1 - Rotate left 5 - Confirm selection\n"..
"8 - Right 3 - Rotate right 0 - Back\n"..
"4 - Left 7 - Rotate left 2\n"..
"6 - Down 9 - Rotate right 2", 80, 350, 1000
)
else
drawText("TV mode is OFF now!", 80, 40, 1000)
drawText("Which controls do you want to configure?", 80, 70, 1000)
end
elseif self.first_time then
drawText("Thanks for playing Tromi!", 80, 40, 1000)
drawText("Please begin by configuring your controls:", 80, 70, 1000)
else
drawText("Which controls do you want to configure?", 80, 70, 1000)
end
drawBigText(table.concat(secret_code_input, " "), 80, 100, 1000)
love.graphics.setColor(1, 1, 1, 0.5)
love.graphics.rectangle("fill", 75, 120 + 40 * self.menu_state, 300, 40)
@@ -134,12 +132,18 @@ local function checkSecretCodeInput(self, key)
if secret_code_used then return end
if key:sub(1, 2) == "kp" then
table.insert(secret_code_input, key:sub(3,3))
elseif key:find("[0-9]") == 1 then
elseif key:find("[0-9.]") == 1 then
table.insert(secret_code_input, key)
else
secret_code_input = {} -- Reset
end
if table.concat(secret_code_input, "") == "79338732" then
if #secret_code_input > 8 then
table.remove(secret_code_input, 1)
end
local current_code = table.concat(secret_code_input, "")
if current_code == "88663366" then --TVMODEON
-- Set keybind
SETTINGS.input.keys = {
["2"] = "up", ["kp2"] = "up",
@@ -154,8 +158,13 @@ local function checkSecretCodeInput(self, key)
["0"] = "menu_back", ["kp0"] = "menu_back",
}
SETTINGS.firstTime = false
SETTINGS.tvMode = true
secret_code_used = true
updateButtonList(self)
elseif current_code == "........" then
SETTINGS.input.keys = {}
SETTINGS.tvMode = false
secret_code_used = true
end
end