🔞 ADULT: Mattie dev/playdate sudoku/pull/ - Complete Album!

Skip to content

Conversation

@romanthekat

This PR is a continuation of #1 and supersedes it , provides other bugfixes I added in the fork:

  • fix: lags on device due to font object recreation (from fix: create possible number font only once #1 )
  • fix: notation doesn't stop working in certain cases
  • fix: congratulations timer effect won't be triggered when you manually return to home
  • fix: minor typos in methods names
  • feat: simple icon

@romanthekat

Latest build: sudoku.pdx.zip

romanthekat
local gfx <const> = playdate.graphics
local menu = playdate.getSystemMenu()

local congratulationsTimer = nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't really like global vars, but if exit to menu w/o waiting for the timer finish, then it will still be triggered once 10 seconds pass.
We do remove the sprites later down the load, but the timer will still exist and will trigger the logic behind 'congratulations sprite'.

romanthekat
gfx.sprite.removeAll()

if congratulationsTimer ~= nil then
removeGameData()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so that if we go to title screen, and there was a congratulation screen before, we clean saved state (e.g. button Continue will disappear since we finished the play)

romanthekat
board.boardData.isNoting = true
if board.boardData.selected ~= nil and board.boardData.selected.status ~= status.Given then
board.boardData.selected.number = 0
board.boardData.selected.status = status["Empty"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we initiate notation mode we clean the previous status in addition to resetting the number.
so that, if there was a number provided by user, then status won't be left equal to Given or Guessed.
otherwise, if we initiate notation mode, togglePossibleNumber won't work because it checks if status is Empty.

romanthekat

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather low quality, I just cropped the launchImage file to 32x32

romanthekat
import "CoreLibs/timer"

local gfx <const> = playdate.graphics
local possibleNumberFont = gfx.font.new("font-Bitmore")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we only read the font once, and then reuse it. this particular update fixed the lag on my device

@mattie-dev

Thank you so much for helping and fixing so many problems in the codebase!

@mattie-dev mattie-dev merged commit fc32a88 into mattie-dev:main Oct 22, 2023
romanthekat
function removeGameData()
playdate.datastore.delete("board_table")
end
function useless()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it, since it's useless :)

@romanthekat

Thank you for creating such a nice game =^__^=
One of the most played for me 😸

@romanthekat romanthekat mentioned this pull request Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants