diff options
| author | 1029chris <1029chris@gmail.com> | 2022-02-07 16:06:16 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2022-02-07 16:06:16 -0800 |
| commit | 30b101183afa1d9bbf041a2c05ca4f33673fa13c (patch) | |
| tree | 2f1615b97f62d383a3dc00b04c57699639602d96 | |
| parent | 302a6cf19d239207d0cfc990ee53e9f1f7544dc9 (diff) | |
Added scrolling sprite function, and stars!!!!
| -rw-r--r-- | background.lua | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/background.lua b/background.lua index 973509e..cc05b50 100644 --- a/background.lua +++ b/background.lua @@ -6,6 +6,10 @@ function scrollingcircles(y, speed, spacing, radius, color) end end +function scrollingsprite(sprite,x,y,w,h,speed) + spr(sprite, (-t()*speed+x+w*8)%(128+w*8)-w*8, y, w, h) +end + function addbgcircle(x, y, velx, r, color, pos) local circle = {} @@ -29,19 +33,36 @@ end function drawbg() cls(0) camera((sin(shake+t())*shake)/3, (sin(shake+t()/2.1)*shake)/3) - - --static planet - spr(202,80,62,6,3) - spr(249,72,86,7,1) + --stars + for i = 1, 64, 1 do + pset(((-t()+i*2)*(i/32))%128, sin(i*0.536382)*64+64, 4) + end + + --static planet + spr(201,110-t()/4,62,7,3) + spr(249,102-t()/4,86,7,1) --clouds scrollingcircles(-9, 24, 22, 22, 4) scrollingcircles(-14, 40, 25, 20, 13) + scrollingsprite(194, 60, 16, 2, 1, 30) + scrollingsprite(196, 100, 18, 2, 1, 34) + scrollingsprite(198, 20, 20, 2, 1, 38) camera((sin(shake+t())*shake)/2, (sin(shake+t()/2.1)*shake)/2) --landscape scrollingcircles(110, 72, 25, 20, 8) + + --buildings + scrollingsprite(231,100,65+16,2,2,78) + scrollingsprite(226,65,67+16,2,2,80) + scrollingsprite(192,55,69,2,4,81) + scrollingsprite(230,85,70+16,1,2,82) + scrollingsprite(228,40,72+16,2,2,84) + scrollingsprite(192,20,75,2,4,86) + scrollingsprite(192,120,80,2,4,88) + camera(sin(shake+t())*shake, sin(shake+t()/2.1)*shake) scrollingcircles(135, 100, 30, 32, 15) end
\ No newline at end of file |
