春节主题+背景+音乐
This commit is contained in:
@@ -829,6 +829,8 @@ function WIDGET.set(list)
|
|||||||
local c1,c2,c3
|
local c1,c2,c3
|
||||||
if FESTIVAL=="Xmas"then
|
if FESTIVAL=="Xmas"then
|
||||||
c1,c2,c3=COLOR.red,COLOR.white,COLOR.green
|
c1,c2,c3=COLOR.red,COLOR.white,COLOR.green
|
||||||
|
elseif FESTIVAL=="sprFes"then
|
||||||
|
c1,c2,c3=COLOR.red,COLOR.orange,COLOR.yellow
|
||||||
end
|
end
|
||||||
for _,W in next,list do
|
for _,W in next,list do
|
||||||
if W.color then
|
if W.color then
|
||||||
|
|||||||
23
main.lua
23
main.lua
@@ -26,7 +26,16 @@ LOGIN=false
|
|||||||
EDITING=""
|
EDITING=""
|
||||||
WSCONN=false
|
WSCONN=false
|
||||||
FESTIVAL=
|
FESTIVAL=
|
||||||
os.date"%m"=="12"and math.abs(os.date"%d"-25)<4 and"Xmas"
|
os.date"%m"=="12"and math.abs(os.date"%d"-25)<4 and"Xmas"or
|
||||||
|
os.date"%m"<"03"and math.abs(({--Spring festival dates, 1.2=2, 2.1=32, etc.
|
||||||
|
24,43,32,22,40,29,49,38,26,45,
|
||||||
|
34,23,41,31,50,39,28,47,36,25,
|
||||||
|
43,32,22,41,29,48,37,26,44,34,
|
||||||
|
23,42,31,50,39,28,46,35,24,43,
|
||||||
|
32,22,41,30,48,37,26,45,33,23,
|
||||||
|
42,32,50,39,28,46,35,24,43,33,
|
||||||
|
21,40,
|
||||||
|
})[0+os.date"%y"]-((os.date"%m"=="01"and 0 or 31)+os.date"%d"))<8 and"sprFes"
|
||||||
|
|
||||||
math.randomseed(os.time()*626)
|
math.randomseed(os.time()*626)
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
@@ -356,5 +365,13 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
BG.setDefault(FESTIVAL=="Xmas"and"snow"or"space")
|
if FESTIVAL=="Xmas"then
|
||||||
BGM.setDefault(FESTIVAL=="Xmas"and"mXmas"or"blank")
|
BG.setDefault("snow")
|
||||||
|
BGM.setDefault("mXmas")
|
||||||
|
elseif FESTIVAL=="sprFes"then
|
||||||
|
BG.setDefault("firework")
|
||||||
|
BGM.setDefault("spring festival")
|
||||||
|
else
|
||||||
|
BG.setDefault("space")
|
||||||
|
BGM.setDefault("blank")
|
||||||
|
end
|
||||||
BIN
media/BGM/spring festival.ogg
Normal file
BIN
media/BGM/spring festival.ogg
Normal file
Binary file not shown.
99
parts/backgrounds/firework.lua
Normal file
99
parts/backgrounds/firework.lua
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
--Firework
|
||||||
|
local gc=love.graphics
|
||||||
|
local circle,line=gc.circle,gc.line
|
||||||
|
local rnd=math.random
|
||||||
|
local ins,rem=table.insert,table.remove
|
||||||
|
local back={}
|
||||||
|
|
||||||
|
local t
|
||||||
|
local firework,particle
|
||||||
|
function back.init()
|
||||||
|
t=26
|
||||||
|
firework,particle={},{}
|
||||||
|
BG.resize()
|
||||||
|
end
|
||||||
|
function back.update(dt)
|
||||||
|
t=t-1
|
||||||
|
if t==0 then
|
||||||
|
ins(firework,{
|
||||||
|
x=nil,y=nil,
|
||||||
|
x0=SCR.W*(rnd()*1.2-.1),
|
||||||
|
y0=SCR.H*1.5,
|
||||||
|
x1=SCR.W*(.15+rnd()*.7),
|
||||||
|
y1=SCR.H*(.15+rnd()*.4),
|
||||||
|
t=0,
|
||||||
|
v=.5+rnd(),
|
||||||
|
color=COLOR.random_bright(),
|
||||||
|
big=rnd()<.1,
|
||||||
|
})
|
||||||
|
t=rnd(26,62)
|
||||||
|
end
|
||||||
|
for i=#firework,1,-1 do
|
||||||
|
local F=firework[i]
|
||||||
|
local time=F.t^.5
|
||||||
|
if time>1 then
|
||||||
|
local x,y,color=F.x,F.y,F.color
|
||||||
|
if F.big then
|
||||||
|
SFX.play("clear_3",.4)
|
||||||
|
for _=1,rnd(62,126)do
|
||||||
|
ins(particle,{
|
||||||
|
x=x,y=y,
|
||||||
|
color=color,
|
||||||
|
vx=rnd()*16-8,
|
||||||
|
vy=rnd()*16-8,
|
||||||
|
t=1,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
SFX.play("clear_2",.35)
|
||||||
|
for _=1,rnd(16,26)do
|
||||||
|
ins(particle,{
|
||||||
|
x=x,y=y,
|
||||||
|
color=color,
|
||||||
|
vx=rnd()*8-4,
|
||||||
|
vy=rnd()*8-4,
|
||||||
|
t=1,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rem(firework,i)
|
||||||
|
else
|
||||||
|
F.t=F.t+dt*F.v
|
||||||
|
F.x=F.x0*(1-time)+F.x1*time
|
||||||
|
F.y=F.y0*(1-time)+F.y1*time
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=#particle,1,-1 do
|
||||||
|
local P=particle[i]
|
||||||
|
if P.t<0 then
|
||||||
|
rem(particle,i)
|
||||||
|
else
|
||||||
|
P.x=P.x+P.vx
|
||||||
|
P.y=P.y+P.vy
|
||||||
|
P.vy=P.vy+.04
|
||||||
|
P.t=P.t-dt*.6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function back.draw()
|
||||||
|
gc.clear(.1,.1,.1)
|
||||||
|
gc.push("transform")
|
||||||
|
gc.origin()
|
||||||
|
for i=1,#firework do
|
||||||
|
local F=firework[i]
|
||||||
|
gc.setColor(F.color)
|
||||||
|
circle("fill",F.x,F.y,F.big and 8 or 4)
|
||||||
|
end
|
||||||
|
gc.setLineWidth(3)
|
||||||
|
for i=1,#particle do
|
||||||
|
local P=particle[i]
|
||||||
|
local c=P.color
|
||||||
|
gc.setColor(c[1],c[2],c[3],P.t)
|
||||||
|
line(P.x,P.y,P.x-P.vx*4,P.y-P.vy*4)
|
||||||
|
end
|
||||||
|
gc.pop()
|
||||||
|
end
|
||||||
|
function back.discard()
|
||||||
|
firework=nil
|
||||||
|
end
|
||||||
|
return back
|
||||||
@@ -65,6 +65,13 @@ local eggInput={
|
|||||||
BGM.setDefault("mXmas")
|
BGM.setDefault("mXmas")
|
||||||
BGM.play()
|
BGM.play()
|
||||||
end,
|
end,
|
||||||
|
sprfes=function()
|
||||||
|
FESTIVAL="sprFes"
|
||||||
|
BG.setDefault("firework")
|
||||||
|
BGM.setDefault("spring festival")
|
||||||
|
BGM.play()
|
||||||
|
end,
|
||||||
|
spring="sprfes",
|
||||||
}for k,v in next,eggInput do if type(v)=="string"then eggInput[k]=eggInput[v]end end
|
}for k,v in next,eggInput do if type(v)=="string"then eggInput[k]=eggInput[v]end end
|
||||||
local function search()
|
local function search()
|
||||||
if eggInput[input]then
|
if eggInput[input]then
|
||||||
|
|||||||
Reference in New Issue
Block a user