Last active
March 2, 2024 13:20
-
-
Save ampersanda/419bcb753ba3c301ac6c681af9f0ae6e to your computer and use it in GitHub Desktop.
Playdate 10Print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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