info = { type = "image", title = "City", category = "city", author = "BRRRO", version = "1.0", license = "MIT", desc = "Dusk over a city, two layers of buildings", api = 33, } local floor = math.floor local BTC = { "00101000","11111100","01100110","01100110","01111100","01100011","01100011","11111110","00101000" } local LAYER = { { 6, 50, 8, 104, 92, 134, 235, 212, 150 }, { 15.6, 61, 6, 60, 54, 88, 255, 226, 150 }, } local BG function render() local W, H = gfx.W, gfx.H local t = frame / gfx.FPS if BG then gfx.blit_rgb(BG, 0, 0, W, H) else for y = 0, H - 1 do local f = y / H gfx.rect(0, y, W, 1, 92 + 142 * f, 74 + 88 * f, 124 - 4 * f) end BG = gfx.snapshot(0, 0, W, H) end for l = 1, 2 do local L = LAYER[l] local off = t * L[1] local ioff = floor(off) local base, bw = L[2], L[3] for x = 0, W - 1 do local bi = floor((x + off) / bw) local h = 12 + ((bi * 131) % 6) * 4 local top = base - h local y0 = top > 0 and top or 0 gfx.rect(x, y0, 1, base - y0, L[4], L[5], L[6]) if (x + ioff) % 3 == 1 then for y = y0, base - 1 do if y > top + 2 and y % 4 == 1 then gfx.px(x, y, L[7], L[8], L[9]) end end end end end if floor(t * 3.75) % 2 == 1 then for r = 1, 9 do local row = BTC[r] for c = 1, 8 do if row:sub(c, c) == "1" then gfx.px(12 + c, 15 + r, 255, 176, 64) end end end end end