diff options
| author | 1029chris <1029chris@gmail.com> | 2022-02-02 18:24:53 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2022-02-02 18:24:53 -0800 |
| commit | b23dbf913d15fca6e537898b406c7428948d8c21 (patch) | |
| tree | 5f49b67f90645905e3ef65fd9b4a8b78d8b1284b /background.lua | |
| parent | 377c0bdb35fd9eddc0e144f2c540f2cc8f733036 (diff) | |
uniform circle scrolling function!
Diffstat (limited to 'background.lua')
| -rw-r--r-- | background.lua | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/background.lua b/background.lua index fd5073c..070b050 100644 --- a/background.lua +++ b/background.lua @@ -1,5 +1,10 @@ bgcircles = {} -circletimer = 0 + +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) @@ -21,20 +26,10 @@ function addbgcircle(x, y, velx, r, color, pos) add(bgcircles,circle, pos) end - - - - function drawbg() cls(1) - - circletimer -= 1/60 - if circletimer < 0 then - circletimer = .8 - addbgcircle(180,100,-1,32,3) - end - - foreach(bgcircles, function(circle) circle:draw() end) + scrollingcircles(90, 50, 25, 16, 5) + scrollingcircles(120, 100, 50, 32, 3) -- rectfill(0,0,128,16,13) -- rectfill(0,64,128,128,13) |
