Skip to content

Instantly share code, notes, and snippets.

@ampersanda
Last active March 2, 2024 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ampersanda/419bcb753ba3c301ac6c681af9f0ae6e to your computer and use it in GitHub Desktop.
Save ampersanda/419bcb753ba3c301ac6c681af9f0ae6e to your computer and use it in GitHub Desktop.
Playdate 10Print
import "CoreLibs/graphics"
local gfx<const> = playdate.graphics
local dsp<const> = playdate.display
local spacing<const> = 10
local xCount
local yCount
local x = 0
local y = 0
local invert = false
function setup()
dsp.setScale(2)
xCount = dsp.getWidth() / spacing
yCount = dsp.getHeight() / spacing
end
setup()
function playdate.update()
if math.random() < 0.5 then
gfx.drawLine(x, y, x + spacing, y + spacing)
else
gfx.drawLine(x, y + spacing, x + spacing, y)
end
x = x + spacing
if x > dsp.getWidth() then
x = 0
y = y + spacing
if y >= dsp.getHeight() then
y = 0
invert = not invert
dsp.setInverted(invert)
gfx.clear()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment