Back to Powder Tool V600Billion
SOURCE / PINNED RELEASE

Made of little things.

Powder Tool V600Billion

Release
142767edcab8…
Author-recorded commit
6d92971effd0…
License
LICENSE
Author’s source reference
nostr://npub1fllw8kw0thjj55wds0uugcnp5kej2nfxd36eruq39d56wwz8r44q5q78wj/wss%3A%2F%2Fgit.napplet.soy%2F/powder-toy

Archive hash verified: ed7d6a8ea7083197…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

source/src/scenes/06-fireworks.lua
-- title: Fireworks
-- icon: 🎆
-- blurb: Rockets go up one after another over a city at night.
-- hint: Draw some FIRW on a roof and touch it with FIRE to launch your own.
-- view: 4
-- thumb: 5
local BRCK, FIRW = E.DEFAULT_PT_BRCK, E.DEFAULT_PT_FIRW
walls(0, 372, 611, 383)

-- Skyline with lit windows
local roofs = {}
local x = 8
while x < 600 do
  local w, h = math.random(34, 60), math.random(60, 200)
  if x + w > 604 then w = 604 - x end
  box(x, 371 - h, x + w - 1, 371, BRCK)
  set(x, 371 - h, x + w - 1, 371, "dcolour", 0xFF1C2230)
  for wy = 371 - h + 8, 360, 12 do
    for wx = x + 5, x + w - 9, 10 do
      if math.random() < 0.55 then set(wx, wy, wx + 4, wy + 5, "dcolour", 0xFFFFD27A) end
    end
  end
  roofs[#roofs + 1] = { x + math.floor(w / 2), 371 - h - 1 }
  x = x + w + math.random(4, 10)
end

-- A rocket from a random roof every so often
local frame = 0
every(function()
  frame = frame + 1
  if frame % 24 == 0 then
    local roof = roofs[math.random(#roofs)]
    for k = 0, math.random(2, 4) do
      local i = sim.partCreate(-1, roof[1] + k, roof[2] - (k % 2), FIRW)
      if i >= 0 then
        local life = math.random(24, 38)
        sim.partProperty(i, "tmp", 1)
        sim.partProperty(i, "life", life)
        sim.partProperty(i, "vx", (math.random() - 0.5) * 1.5)
        sim.partProperty(i, "vy", -(life + 20) * 0.2)
      end
    end
  end
end)