diff options
Diffstat (limited to 'assets/scripts/mainMenu.lua')
| -rw-r--r-- | assets/scripts/mainMenu.lua | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/assets/scripts/mainMenu.lua b/assets/scripts/mainMenu.lua index 7ed16cc..05272af 100644 --- a/assets/scripts/mainMenu.lua +++ b/assets/scripts/mainMenu.lua @@ -7,19 +7,34 @@ bigButtonWidth = 150; bigButtonHeight = buttonHeight; characterSelectType = "" +Input = { + prevKeys = {}, + isKeyPressedOnce = function(key) + local code = getKeycodeByName(key) + local wasDown = Input.prevKeys[code] + local isDown = keys[code] + Input.prevKeys[code] = isDown + return isDown and not wasDown + end, + isKeyDown = function(key) + local code = getKeycodeByName(key) + return keys[code] + end +} + function Setup() setBgImage("assets/backgrounds/city-background-1.png") end function Local2PButton() - characterSelectType = "Local2P" + characterSelectType = "Local 2P" dofile("assets/scripts/character-select.lua") Setup() end function MultiplayerButton() characterSelectType = "Multiplayer" - dofile("assets/scripts/multiplayer.lua") + dofile("assets/scripts/character-select.lua") Setup() end @@ -33,16 +48,5 @@ function Update() queueButtonForRender("Local 2P", WIDTH // 2 - buttonWidth // 2, HEIGHT // 2 - buttonHeight // 2, buttonWidth, buttonHeight, "Local2PButton"); queueButtonForRender("Multiplayer", WIDTH // 2 - bigButtonWidth // 2, HEIGHT // 2 - bigButtonHeight // 2 + 55, bigButtonWidth, bigButtonHeight, "MultiplayerButton"); queueButtonForRender("Settings", WIDTH // 2 - buttonWidth // 2, HEIGHT // 2 - buttonHeight // 2 + 55 + 55, buttonWidth, buttonHeight, "SettingsButton"); - -- if keys[getKeycodeByName("RIGHT")] or keys[getKeycodeByName("D")] then - -- movePlayer(movementSpeed, 0) - -- end - -- if keys[getKeycodeByName("LEFT")] or keys[getKeycodeByName("A")] then - -- movePlayer(movementSpeed * -1, 0) - -- end - -- if keys[getKeycodeByName("DOWN")] or keys[getKeycodeByName("S")] then - -- movePlayer(0, movementSpeed) - -- end - -- if keys[getKeycodeByName("UP")] or keys[getKeycodeByName("W")] then - -- movePlayer(0, movementSpeed * -1) - -- end + queueButtonForRender("Quit Game", WIDTH - bigButtonWidth - 20, 20, bigButtonWidth, bigButtonHeight, "quitGame") end
\ No newline at end of file |
