Moving more playdate files around, adding a playdate-specific gitignore to the subdirectory and adding an easter egg.

This commit is contained in:
Rezmason
2022-06-06 19:18:59 -07:00
parent fadc1ed639
commit 346bbbb84d
7 changed files with 45 additions and 40 deletions

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -9,7 +9,9 @@ local numColumns <const> = floor(screenWidth / glyphWidth)
local numRows <const> = floor(screenHeight / glyphWidth)
local numCells <const> = numColumns * numRows
local numGlyphs <const> = 133
local numStandardGlyphs <const> = 133
local numPDGlyphs <const> = 10
local numTotalGlyphs <const> = numStandardGlyphs + numPDGlyphs
local numFades <const> = 32
local glyphs = {}
@@ -20,7 +22,7 @@ do
local glyph = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack)
gfx.pushContext(glyph)
for i = 1, numGlyphs do
for i = 1, numTotalGlyphs do
local column = (i - 1) % spritesheetColumns
local row = floor((i - 1) / spritesheetColumns)
glyphSpritesheet:draw(-column * glyphWidth, -row * glyphWidth)
@@ -48,18 +50,6 @@ for i = 1,360 do
sineTable[i] = math.sin(math.pi / 180 * i)
end
-- function fastSin(x)
-- x = x / 360 % 1
-- local sign
-- if x < 0.5 then
-- sign = -1
-- else
-- sign = 1
-- end
-- x = (x % 0.5) * 2 - 0.5
-- return sign * x * x * 4 - 1
-- end
local wobbleA <const> = math.sqrt(2) / 50
local wobbleB <const> = math.sqrt(5) / 50
@@ -74,14 +64,14 @@ for x = 1, numColumns do
cell.glyphCycle = random()
cell.columnTimeOffset = columnTimeOffset
cell.columnSpeedOffset = columnSpeedOffset
cell.glyphIndex = floor(random() * numGlyphs) + 1
cell.glyphIndex = random(numStandardGlyphs)
cell.fadeIndex = -1
cells[#cells + 1] = cell
end
end
playdate.display.setRefreshRate(0)
playdate.display.setRefreshRate(30)
playdate.resetElapsedTime()
function playdate.update()
@@ -96,6 +86,8 @@ function playdate.update()
playdate.resetElapsedTime()
time += delta
local addPDGlyphs = playdate.buttonIsPressed(playdate.kButtonA) and playdate.buttonIsPressed(playdate.kButtonB)
for i = 1, numCells do
local mustDraw = false
local cell = cells[i]
@@ -119,13 +111,17 @@ function playdate.update()
cell.glyphCycle = cell.glyphCycle + delta * 2
if cell.glyphCycle > 1 then
cell.glyphCycle = cell.glyphCycle % 1
local glyphIndex = (cell.glyphIndex + random(20)) % numGlyphs + 1
if cell.glyphIndex ~= glyphIndex then
cell.glyphIndex = glyphIndex
if fadeIndex < numFades then
mustDraw = true
local lastGlyphIndex = cell.glyphIndex
while cell.glyphIndex == lastGlyphIndex do
if addPDGlyphs and random(4) == 1 then
cell.glyphIndex = random(numPDGlyphs) + numStandardGlyphs
else
cell.glyphIndex = random(numStandardGlyphs)
end
end
if fadeIndex < numFades then
mustDraw = true
end
end
if mustDraw then

View File

@@ -1,7 +1,7 @@
name=The Playtrix
name=The Playtrix (Lua build)
author=Rezmason
description=A familiar animation of mysterious raining symbols.
bundleID=net.rezmason.theplaytrix
bundleID=net.rezmason.theplaytrix_lua
version=1.0
buildNumber=1
imagePath=path/to/launcher/assets