Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Nov 17, 2023
1 parent b80773c commit 0414abf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scripts/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
local engine = EngineFactory.new()
:set_title("Carimbo")
:set_width(854)
:set_height(480)
:set_fullscreen(false)
:create()

local squares = {}

for i = 1, 16 do
local name = string.format("blob/%02d.avif", i)
table.insert(squares, name)
end

engine:prefetch(squares)

for _, name in ipairs(squares) do
local square = engine:spawn()
square.pixmap = name
square.on_update = function(self)
self.x = math.random(0, 854)
self.y = math.random(0, 480)
self.angle = math.random(0, 360)
end
end

local gc = engine:spawn()

gc:on_update(function(self)
if collectgarbage("count") / 1024 > 8 then
collectgarbage("collect")
else
collectgarbage("step", 1)
end
end)

engine:run()

0 comments on commit 0414abf

Please sign in to comment.