Skip to content

Commit

Permalink
use escape instead of q key, allow space to skip level welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneSchwettmann committed Nov 23, 2021
1 parent 00c7f71 commit 1e1d684
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/Draw.lua
Expand Up @@ -116,12 +116,12 @@ function drawTitleScreen()
love.graphics.rectangle("fill", floor(centerX-200), floor(centerY-5-75+150), 400, 160 )
love.graphics.setColor(0,0,0,1)
verticalSpacing = 25
love.graphics.printf("Fire(1) or 1 or Click or Touch - Start 1 player game", 0, centerY-10-2.5*verticalSpacing+150,width,"center")
love.graphics.printf("Fire(2) or 2 - Start 2 player game", 0, centerY-10-1.5*verticalSpacing+150,width,"center")
love.graphics.printf("j - Mouse Sensitivity: " ..mouseScaleX / 50, 0, centerY-10-0.5*verticalSpacing+150,width,"center")
love.graphics.printf("f - Toggle fullscreen", 0, centerY-10+0.5*verticalSpacing+150,width,"center")
love.graphics.printf("g - Toggle scaling (fullscreen only)", 0, centerY-10+1.5*verticalSpacing+150,width,"center")
love.graphics.printf("q or Select - Quit", 0, centerY-10+2.5*verticalSpacing+150,width,"center")
love.graphics.printf("Fire(1) or 1 or Click or Touch - Start 1 Player Game", 0, centerY-8-2.5*verticalSpacing+150,width,"center")
love.graphics.printf("Fire(2) or 2 - Start 2 Player Game", 0, centerY-8-1.5*verticalSpacing+150,width,"center")
love.graphics.printf("K / L - Mouse Sensitivity: " ..mouseScaleX / 50, 0, centerY-8-0.5*verticalSpacing+150,width,"center")
love.graphics.printf("F - Toggle Fullscreen", 0, centerY-8+0.5*verticalSpacing+150,width,"center")
love.graphics.printf("G - Toggle Scaling (Fullscreen Only)", 0, centerY-8+1.5*verticalSpacing+150,width,"center")
love.graphics.printf("Esc or Select - Quit", 0, centerY-8+2.5*verticalSpacing+150,width,"center")
end
function drawPauseScreen()
Expand Down
40 changes: 28 additions & 12 deletions src/Input.lua
Expand Up @@ -20,7 +20,7 @@ function getInputPlayer(playerNumber)
-- keyboard
if playerNumber==1 then
if love.keyboard.isDown("a") then
xInput = -500
xInput = -500
end
if love.keyboard.isDown("d") then
xInput = 500
Expand All @@ -29,7 +29,7 @@ function getInputPlayer(playerNumber)
xInput = 0
end
if love.keyboard.isDown("w") then
yInput = -500
yInput = -500
end
if love.keyboard.isDown("s") then
yInput = 500
Expand All @@ -40,7 +40,7 @@ function getInputPlayer(playerNumber)
if love.keyboard.isDown("rctrl") or love.keyboard.isDown("lctrl") then
xInput = xInput * 2
yInput = yInput * 2
end
end
elseif playerNumber==2 then
if love.keyboard.isDown("left") then
xInput = -500
Expand Down Expand Up @@ -90,7 +90,7 @@ function getInputPlayer(playerNumber)
buttonInput = true
end
if joystick:isGamepadDown("back") then
love.keypressed("q")
love.keypressed('q')
end
else
local numButtons = joystick:getButtonCount()
Expand Down Expand Up @@ -203,7 +203,7 @@ function love.gamepadpressed(joystick, button)
and button ~= "dpleft"
and button ~= "dpright") then
if (button == "back") then
love.keypressed('q')
love.keypressed('escape')
elseif (button == "start") then
love.keypressed('p')
elseif gameIsPaused==false and waitingForClick then
Expand All @@ -229,7 +229,7 @@ end

function love.keypressed(key, unicode)
if displayingTitleScreen then
if key == 'q' or key == 'escape' then
if key == 'escape' then
love.event.quit()
elseif key == '2' then
numPlayers=2
Expand All @@ -238,7 +238,7 @@ function love.keypressed(key, unicode)
numPlayers=1
startGame()
end
elseif key == 'q' or key == 'escape' then
elseif key == 'escape' then
titleScreen()
end
if key == 'p' then
Expand Down Expand Up @@ -286,19 +286,35 @@ function love.keypressed(key, unicode)
elseif key == 'f' then
cycleScreenModes()
elseif key == 'g' then
toggleScaling()
elseif key == 'j' then
cycleMouseSensitivity()
toggleScaling()
elseif key == 'k' then
cycleMouseSensitivityBackward()
elseif key == 'l' then
cycleMouseSensitivityForward()
elseif key == 'o' then
showFPS= not showFPS
showFPS = not showFPS
elseif key == "space" then
if gameIsPaused==false and waitingForClick then
waitingForClick=false
end
end
end

function cycleMouseSensitivity()
function cycleMouseSensitivityForward()
mouseScaleX = mouseScaleX + 50
mouseScaleY = mouseScaleY + 50
if mouseScaleX > 1000 then
mouseScaleX = 1000
mouseScaleY = 1000
end
end

function cycleMouseSensitivityBackward()
mouseScaleX = mouseScaleX - 50
mouseScaleY = mouseScaleY - 50
if mouseScaleX < 50 then
mouseScaleX = 50
mouseScaleY = 50
end
end

0 comments on commit 1e1d684

Please sign in to comment.