Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions conf.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
-- conf.lua (Ported to LÖVE 11.5)
function love.conf(t)
t.title = "Not Tetris 2"
t.author = "Maurice"
t.identity = "not_tetris_2"
t.screen.width = 800
t.screen.height = 720
t.screen.fsaa = 0
t.screen.vsync = true
end
t.version = "11.5"
t.console = true
t.window.title = "Not Tetris 2"
t.window.width = 800
t.window.height = 720
t.window.msaa = 0
t.window.vsync = true
end
13 changes: 12 additions & 1 deletion controls.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- Provides keyboard control settings and helper functions for the game.

controls = {}
controls.settings = {}

Expand All @@ -10,13 +12,18 @@ controls.settings.escape = {"key", {"escape"}}
controls.settings.rotateleft = {"key", {"y", "z", "w"}}
controls.settings.rotateright = {"key", {"x"}}

--player 2
--player 2 controls
controls.settings.leftp2 = {"key", {"j"}}
controls.settings.rightp2 = {"key", {"k"}}
controls.settings.downp2 = {"key", {"m"}}
controls.settings.rotateleftp2 = {"key", {"o"}}
controls.settings.rotaterightp2 = {"key", {"p"}}

---
-- Checks whether the given key matches the configured key(s) for a given control action.
-- @param t The control action (e.g. "left", "return", etc.)
-- @param key The key to check.
-- @return boolean true if the key is registered for action t.
function controls.check(t, key)
if controls.settings[t][1] == "key" then
for i = 1, #controls.settings[t][2] do
Expand All @@ -28,6 +35,10 @@ function controls.check(t, key)
end
end

---
-- Checks if any of the keys registered for a control action are currently pressed.
-- @param t The control action.
-- @return boolean true if any key for the action is down.
function controls.isDown(t)
if controls.settings[t][1] == "key" then
for i = 1, #controls.settings[t][2] do
Expand Down
22 changes: 11 additions & 11 deletions failed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ function failed_load()
end

function failed_draw()
--FULLSCREEN OFFSET
-- FULLSCREEN OFFSET
if fullscreen then
love.graphics.translate(fullscreenoffsetX, fullscreenoffsetY)

--scissor
-- scissor
love.graphics.setScissor(fullscreenoffsetX, fullscreenoffsetY, 160*scale, 144*scale)
end

Expand All @@ -22,18 +22,18 @@ function failed_draw()
love.graphics.draw(gameover, 16*scale, 0, 0, scale)
end

--SCORES---------------------------------------
--"score"--
-- SCORES ---------------------------------------
-- "score" --
offsetX = 0

scorestring = tostring(scorescore)
for i = 1, scorestring:len() - 1 do
for i = 1, #scorestring - 1 do
offsetX = offsetX - 8*scale
end
love.graphics.print( scorescore, 144*scale + offsetX, 24*scale, 0, scale)


--"level"--
-- "level" --
offsetX = 0

scorestring = tostring(levelscore)
Expand All @@ -42,22 +42,22 @@ function failed_draw()
end
love.graphics.print( levelscore, 136*scale + offsetX, 56*scale, 0, scale)

--"tiles"--
-- "tiles" --
offsetX = 0

scorestring = tostring(linesscore)
for i = 1, scorestring:len() - 1 do
for i = 1, #scorestring - 1 do
offsetX = offsetX - 8*scale
end
love.graphics.print( linesscore, 136*scale + offsetX, 80*scale, 0, scale)
-----------------------------------------------


--FULLSCREEN OFFSET
-- FULLSCREEN OFFSET
if fullscreen then
love.graphics.translate(-fullscreenoffsetX, -fullscreenoffsetY)

--scissor
-- scissor
love.graphics.setScissor()
end
end
Expand Down Expand Up @@ -93,7 +93,7 @@ function failed_checkhighscores()
break
end
end
if highscoreno == 0 then--no new highscore
if highscoreno == 0 then -- No new highscore
gamestate = "menu"
if musicno < 4 then
love.audio.play(music[musicno])
Expand Down
Loading