代码规范:把所有的tab换成空格
This commit is contained in:
@@ -9,43 +9,43 @@ local back={}
|
||||
local t
|
||||
local snow
|
||||
function back.init()
|
||||
t=0
|
||||
snow={}
|
||||
t=0
|
||||
snow={}
|
||||
end
|
||||
function back.update()
|
||||
t=t+1
|
||||
if t%(t%626>260 and 3 or 6)==0 then
|
||||
ins(snow,{
|
||||
x=SCR.w*rnd(),
|
||||
y=0,
|
||||
vy=1+rnd()*.6,
|
||||
vx=rnd()*2-.5,
|
||||
rx=2+rnd()*2,
|
||||
ry=2+rnd()*2,
|
||||
})
|
||||
end
|
||||
for i=#snow,1,-1 do
|
||||
local P=snow[i]
|
||||
P.y=P.y+P.vy
|
||||
if P.y>SCR.h then
|
||||
rem(snow,i)
|
||||
else
|
||||
P.x=P.x+P.vx
|
||||
P.vx=P.vx-.02+rnd()*.04
|
||||
P.rx=max(min(P.rx+rnd()-.5,4),2)
|
||||
P.ry=max(min(P.ry+rnd()-.5,5),3)
|
||||
end
|
||||
end
|
||||
t=t+1
|
||||
if t%(t%626>260 and 3 or 6)==0 then
|
||||
ins(snow,{
|
||||
x=SCR.w*rnd(),
|
||||
y=0,
|
||||
vy=1+rnd()*.6,
|
||||
vx=rnd()*2-.5,
|
||||
rx=2+rnd()*2,
|
||||
ry=2+rnd()*2,
|
||||
})
|
||||
end
|
||||
for i=#snow,1,-1 do
|
||||
local P=snow[i]
|
||||
P.y=P.y+P.vy
|
||||
if P.y>SCR.h then
|
||||
rem(snow,i)
|
||||
else
|
||||
P.x=P.x+P.vx
|
||||
P.vx=P.vx-.02+rnd()*.04
|
||||
P.rx=max(min(P.rx+rnd()-.5,4),2)
|
||||
P.ry=max(min(P.ry+rnd()-.5,5),3)
|
||||
end
|
||||
end
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.08,.08,.084)
|
||||
gc.setColor(.7,.7,.7)
|
||||
for i=1,#snow do
|
||||
local P=snow[i]
|
||||
ellipse('fill',P.x,P.y,P.rx,P.ry)
|
||||
end
|
||||
gc.clear(.08,.08,.084)
|
||||
gc.setColor(.7,.7,.7)
|
||||
for i=1,#snow do
|
||||
local P=snow[i]
|
||||
ellipse('fill',P.x,P.y,P.rx,P.ry)
|
||||
end
|
||||
end
|
||||
function back.discard()
|
||||
snow=nil
|
||||
snow=nil
|
||||
end
|
||||
return back
|
||||
Reference in New Issue
Block a user