aboutsummaryrefslogtreecommitdiff
path: root/background.lua
blob: 070b050f925ae9c8d629bbe7fe379eea347cf237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
bgcircles = {}

function scrollingcircles(y, speed, spacing, radius, color)
    for i = 1, (128*(radius*4))/spacing, 1 do
        circfill(-time()*speed+(spacing*(i-1)), y, radius, color)
    end
end


function addbgcircle(x, y, velx, r, color, pos)
    local circle = {}
    circle.x = x
    circle.y = y
    circle.velx = velx
    circle.r = r
    circle.color = color

    function circle.draw(circle)
        circle.x += circle.velx

        if circle.x < 0 - circle.r * 2 then
            del(bgcircles, circle)
        end
        circfill(circle.x,circle.y,circle.r,circle.color)
    end
    add(bgcircles,circle, pos)
end

function drawbg()
    cls(1)
    scrollingcircles(90, 50, 25, 16, 5)
    scrollingcircles(120, 100, 50, 32, 3)

    -- rectfill(0,0,128,16,13)
    -- rectfill(0,64,128,128,13)
    -- rectfill(0,80,128,128,2)
end