Add buttons for Replay, add MENU to go out after finishing game or in 20G Training mode

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-24 23:26:19 +07:00
parent 6966177ee3
commit 96809a46f6
6 changed files with 102 additions and 65 deletions

View File

@@ -4,16 +4,14 @@ local lualzw = require 'libs.lualzw'
local bitser = require 'libs.bitser'
local playedReadySE = false
local playedGoSE = false
local Grid = require 'game.grid'
local Randomizer = require 'game.randomizer'
local Piece = require 'game.piece'
local GameMode = Object:extend()
function GameMode:new(player_name, input_file, replay_grade)
VCTRL.toggle(true)
VCTRL.toggle(MOBILE and not input_file)
if player_name == nil then self.training = true else self.training = false end
if input_file ~= nil then
@@ -507,10 +505,10 @@ function GameMode:detectHoles(x, y)
table.insert(self.visited, x..'.'..y)
end
if cell.colour ~= "" or cell.oob then return false end
if self:detectHoles(x+1, y, attempt_num) then return true end
if self:detectHoles(x-1, y, attempt_num) then return true end
if self:detectHoles(x, y+1, attempt_num) then return true end
if self:detectHoles(x, y-1, attempt_num) then return true end
if self:detectHoles(x+1, y) then return true end
if self:detectHoles(x-1, y) then return true end
if self:detectHoles(x, y+1) then return true end
if self:detectHoles(x, y-1) then return true end
return false
end
@@ -520,7 +518,7 @@ function GameMode:stackQualityCheck()
for x=1, 10 do
for y = 1, 20 do
if self.grid:getCell(x, y).colour == "" and not table.contains(self.visited, x..'.'..y) then
stack_clean = self:detectHoles(x, y)
local stack_clean = self:detectHoles(x, y)
if not stack_clean then
hole_num = hole_num + 1
end
@@ -993,7 +991,7 @@ function GameMode:drawScoringInfo()
love.graphics.rectangle("fill", 68, 270, 140, 190, 10, 10)
love.graphics.setColor(0.05,0.05,0.05,1)
love.graphics.rectangle("fill", 65, 267, 140, 190, 10, 10)
drawText(string.format("Replay in progress\nRotate Left:\n Pause/Frame Step\nRotate Right:\n Unpause\nLeft:\n Rewind 5 sec\nRight:\n FF 10 secs\n%s", formatTime(self.frames)), 70, 275, 1000, "left")
drawText(string.format("Replay in progress\n\n\n\n\n\n\n\n\n%s", formatTime(self.frames)), 70, 275, 1000, "left")
drawBigText(string.format("%s", self.grade), 100, 143, 1000, "left")
self:drawInputDisplay(103,185)
elseif not PENTO_MODE then
@@ -1069,11 +1067,7 @@ function GameMode:drawBackground()
end
if bg == 0 or bg == 8 or bg == 9 or bg == 3 then brightness = 0.7 end
love.graphics.setColor(brightness, brightness, brightness, 1)
love.graphics.draw(
BACKGROUNDS[bg],
0, 0, 0,
1,1
)
love.graphics.draw(BACKGROUNDS[bg])
end
function GameMode:drawFrame()