可交互背景系统试验(给无尽挖掘装上了)
This commit is contained in:
@@ -58,6 +58,78 @@ back.flink={
|
||||
end
|
||||
end,
|
||||
}--Flash after random time
|
||||
|
||||
local wingColor={
|
||||
{0., .9, .9,.626},
|
||||
{.3, 1., .3,.626},
|
||||
{.9, .9, 0.,.626},
|
||||
{1., .5, 0.,.626},
|
||||
{1., .3, .3,.626},
|
||||
{.5, 0., 1.,.626},
|
||||
{.3, .3, 1.,.626},
|
||||
{0., .9, .9,.626},
|
||||
}
|
||||
back.wing={
|
||||
init=function()
|
||||
t=rnd(02200,19600)
|
||||
|
||||
gc.setDefaultFilter("linear","linear")
|
||||
bar=gc.newCanvas(41,1)
|
||||
gc.push("transform")
|
||||
gc.origin()
|
||||
gc.setCanvas(bar)
|
||||
for x=0,20 do
|
||||
gc.setColor(1,1,1,x/11)
|
||||
gc.rectangle("fill",x,0,1,1)
|
||||
gc.rectangle("fill",41-x,0,1,1)
|
||||
end
|
||||
gc.setCanvas()
|
||||
gc.pop()
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
crystal={}
|
||||
W,H=scr.W,scr.H
|
||||
for i=1,16 do
|
||||
crystal[i]={
|
||||
x=i<9 and W*.05*i or W*.05*(28-i),
|
||||
y=H*.1,
|
||||
a=0,
|
||||
va=0,
|
||||
aa=0,
|
||||
f=i<9 and .011-i*.0003 or .011-(17-i)*.0003
|
||||
}
|
||||
end
|
||||
end,
|
||||
update=function()
|
||||
t=t+1
|
||||
for i=1,16 do
|
||||
local B=crystal[i]
|
||||
B.a=B.a+B.va
|
||||
B.va=B.va*.986+B.aa
|
||||
B.va=B.va-B.a*B.f
|
||||
end
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(.06,.06,.06)
|
||||
local sy=H*.8
|
||||
for i=1,8 do
|
||||
gc.setColor(wingColor[i])
|
||||
local B=crystal[i]
|
||||
gc.draw(bar,B.x,B.y,B.a,1,sy,20,0)
|
||||
B=crystal[17-i]
|
||||
gc.draw(bar,B.x,B.y,B.a,1,sy,20,0)
|
||||
end
|
||||
end,
|
||||
event=function(level)
|
||||
for i=1,8 do
|
||||
local B=crystal[i]
|
||||
B.va=B.va+.002*(level*.5)*(rnd()+(9-i)/16)
|
||||
B=crystal[17-i]
|
||||
B.va=B.va-.002*(level*.5)*(rnd()+i/16)
|
||||
end
|
||||
end,
|
||||
}
|
||||
back.aura={
|
||||
init=function()
|
||||
t=rnd()*3600
|
||||
@@ -260,8 +332,9 @@ for _,bg in next,back do
|
||||
if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars)
|
||||
if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars)
|
||||
if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars)
|
||||
if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars)
|
||||
if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars)
|
||||
if not bg.event then bg.event= NULL end setfenv(bg.event ,BGvars)
|
||||
if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars)
|
||||
end
|
||||
|
||||
BG={
|
||||
@@ -270,6 +343,11 @@ BG={
|
||||
update=NULL,
|
||||
draw=back.none.draw,
|
||||
}
|
||||
function BG.send(data)
|
||||
if BG.event then
|
||||
BG.event(data)
|
||||
end
|
||||
end
|
||||
function BG.set(bg,data)
|
||||
if bg==BG.cur or not setting.bg then return end
|
||||
if BG.discard then
|
||||
@@ -282,8 +360,9 @@ function BG.set(bg,data)
|
||||
BG.init=bg.init or NULL
|
||||
BG.resize=bg.resize or NULL
|
||||
BG.update=bg.update or NULL
|
||||
BG.discard=bg.discard or NULL
|
||||
BG.draw=bg.draw or NULL
|
||||
BG.event=bg.event or NULL
|
||||
BG.discard=bg.discard or NULL
|
||||
BG.init()
|
||||
end
|
||||
return BG
|
||||
Reference in New Issue
Block a user