整理代码

This commit is contained in:
MrZ626
2020-12-15 23:55:32 +08:00
parent cf3ca2e9e0
commit e732aae87b
30 changed files with 149 additions and 168 deletions

View File

@@ -29,7 +29,6 @@ local int,rnd,abs=math.floor,math.random,math.abs
local min=math.min
local ins,rem=table.insert,table.remove
local SCR=SCR
local setFont=setFont
local mx,my,mouseShow=-20,-20,false
local touching=nil--First touching ID(userdata)
@@ -418,7 +417,7 @@ function love.run()
local SCN=SCN
local SETTING=SETTING
local Timer=love.timer.getTime
local TIME=love.timer.getTime
local STEP,WAIT=love.timer.step,love.timer.sleep
local MINI=love.window.isMinimized
local PUMP,POLL=love.event.pump,love.event.poll
@@ -427,7 +426,7 @@ function love.run()
local frameTimeList={}
local lastFrame=Timer()
local lastFrame=TIME()
local lastFreshPow=lastFrame
local FCT=0--Framedraw counter, from 0~99
@@ -443,9 +442,9 @@ function love.run()
return function()
local _
local T=Timer()
local dt=T-lastFrame
lastFrame=T
local t=TIME()
local dt=t-lastFrame
lastFrame=t
--EVENT
PUMP()
@@ -490,11 +489,11 @@ function love.run()
--Draw cursor
if mouseShow then
local r=T*.5
local r=t*.5
local R=int(r)%7+1
_=SKIN.libColor[SETTING.skin[R]]
gc.setColor(_[1],_[2],_[3],min(1-abs(1-r%1*2),.3))
gc.draw(TEXTURE.miniBlock[R],mx,my,T%3.1416*4,20,20,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],mx,my,t%3.1416*4,20,20,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
gc.setColor(1,1,1)gc.circle("fill",mx,my,3)
end
@@ -517,8 +516,8 @@ function love.run()
--Draw network working
if TASK.netTaskCount>0 then
setFont(30)
gc.setColor(COLOR.rainbow(T*5))
gc.print("E",1250,0,.26+.355*math.sin(T*6.26))
gc.setColor(COLOR.rainbow(t*5))
gc.print("E",SCR.safeW-18,17,.26+.355*math.sin(t*6.26),nil,nil,8,20)
end
--Draw FPS
@@ -552,10 +551,10 @@ function love.run()
end
--Fresh power info.
if Timer()-lastFreshPow>2.6 then
if TIME()-lastFreshPow>2.6 then
if SETTING.powerInfo and LOADED then
updatePowerInfo()
lastFreshPow=Timer()
lastFreshPow=TIME()
end
if gc.getWidth()~=SCR.w then
love.resize(gc.getWidth(),gc.getHeight())
@@ -563,8 +562,8 @@ function love.run()
end
--Keep 60fps
_=Timer()-lastFrame
_=TIME()-lastFrame
if _<.016 then WAIT(.016-_)end
while Timer()-lastFrame<1/60-5e-6 do WAIT(0)end
while TIME()-lastFrame<1/60-5e-6 do WAIT(0)end
end
end

View File

@@ -1,10 +1,9 @@
local gc=love.graphics
local kb=love.keyboard
local int,abs=math.floor,math.abs
local max,min=math.max,math.min
local sub,format=string.sub,string.format
local Timer=love.timer.getTime
local setFont,mStr=setFont,mStr
local WIDGET={}
@@ -463,8 +462,8 @@ function slider:drag(x)
if p~=P then
self.code(P)
end
if self.change and Timer()-self.lastTime>.18 then
self.lastTime=Timer()
if self.change and TIME()-self.lastTime>.18 then
self.lastTime=TIME()
self.change()
end
end
@@ -478,8 +477,8 @@ function slider:arrowKey(isLeft)
local P=isLeft and max(p-u,0)or min(p+u,self.unit)
if p==P or not P then return end
self.code(P)
if self.change and Timer()-self.lastTime>.18 then
self.lastTime=Timer()
if self.change and TIME()-self.lastTime>.18 then
self.lastTime=TIME()
self.change()
end
end
@@ -584,7 +583,7 @@ function selector:draw()
gc.rectangle("line",x,y,w,60)
gc.setColor(1,1,1,.2+ATV*.1)
local t=(Timer()%.5)^.5
local t=(TIME()%.5)^.5
if self.select>1 then
gc.draw(drawableText.small,x+6,y+20)
if ATV>0 then
@@ -946,8 +945,8 @@ function WIDGET.gamepadPressed(i)
local P=i=="left"and(p>0 and p-1)or p<W.unit and p+1
if p==P or not P then return end
W.code(P)
if W.change and Timer()-W.lastTime>.18 then
W.lastTime=Timer()
if W.change and TIME()-W.lastTime>.18 then
W.lastTime=TIME()
W.change()
end
end

View File

@@ -13,6 +13,7 @@ local fs=love.filesystem
--?
NONE={}function NULL()end
DBP=print--Use this in permanent code
TIME=love.timer.getTime
SYSTEM=love.system.getOS()
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
SAVEDIR=fs.getSaveDirectory()

View File

@@ -699,7 +699,7 @@ end
local noRecList={"custom","solo","round","techmino"}
local function getModList()
local res={}
for k,v in next,GAME.mod do
for _,v in next,GAME.mod do
if v.sel>0 then
ins(res,{v.no,v.sel})
end

View File

@@ -6,18 +6,18 @@ MODOPT={--Mod options
{no=0,id="NX",name="next",
key="q",x=80,y=230,color="orange",
list={0,1,2,3,4,5,6},
func=function(P,M)P.gameEnv.nextCount=M.list[M.sel]end,
func=function(P,O)P.gameEnv.nextCount=O end,
},
{no=1,id="HL",name="hold",
key="w",x=200,y=230,color="orange",
list={0,1,2,3,4,5,6},
func=function(P,M)P.gameEnv.holdCount=M.list[M.sel]end,
func=function(P,O)P.gameEnv.holdCount=O end,
unranked=true,
},
{no=2,id="FL",name="hideNext",
key="e",x=320,y=230,color="water",
list={1,2,3,4,5},
func=function(P,M)P.gameEnv.nextStartPos=M.list[M.sel]+1 end,
func=function(P,O)P.gameEnv.nextStartPos=O +1 end,
},
{no=3,id="IH",name="infHold",
key="r",x=440,y=230,color="water",
@@ -35,48 +35,48 @@ MODOPT={--Mod options
{no=6,id="HD",name="hidden",
key="i",x=920,y=230,color="grape",
list={"time","fast","none"},
func=function(P,M)P.gameEnv.visible=M.list[M.sel]end,
func=function(P,O)P.gameEnv.visible=O end,
unranked=true,
},
{no=7,id="HB",name="hideBoard",
key="o",x=1040,y=230,color="grape",
list={"down","up","all"},
func=function(P)LOG.print("该mod还没有做好!")end,
func=function(P,O)P.gameEnv.hideBoard=O end,
},
{no=8,id="FB",name="flipBoard",
key="p",x=1160,y=230,color="grass",
list={"UD","LR","180"},
func=function(P)LOG.print("该mod还没有做好!")end,
func=function(P,O)P.gameEnv.flipBoard=O end,
},
{no=9,id="DT",name="dropDelay",
key="a",x=140,y=350,color="red",
list={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
func=function(P,M)P.gameEnv.drop=M.list[M.sel]end,
func=function(P,O)P.gameEnv.drop=O end,
unranked=true,
},
{no=10,id="LT",name="lockDelay",
key="s",x=260,y=350,color="red",
list={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
func=function(P,M)P.gameEnv.lock=M.list[M.sel]end,
func=function(P,O)P.gameEnv.lock=O end,
unranked=true,
},
{no=11,id="ST",name="waitDelay",
key="d",x=380,y=350,color="red",
list={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
func=function(P,M)P.gameEnv.wait=M.list[M.sel]end,
func=function(P,O)P.gameEnv.wait=O end,
unranked=true,
},
{no=12,id="CT",name="fallDelay",
key="f",x=500,y=350,color="red",
list={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
func=function(P,M)P.gameEnv.fall=M.list[M.sel]end,
func=function(P,O)P.gameEnv.fall=O end,
unranked=true,
},
{no=13,id="LF",name="life",
key="j",x=860,y=350,color="yellow",
list={0,1,2,3,5,10,15,26,42,87,500},
func=function(P,M)P.gameEnv.life=M.list[M.sel]end,
func=function(P,O)P.gameEnv.life=O end,
unranked=true,
},
{no=14,id="FB",name="forceB2B",
@@ -116,19 +116,19 @@ MODOPT={--Mod options
{no=19,id="CS",name="customSeq",
key="b",x=680,y=470,color="blue",
list={"bag","his4","rnd","reverb"},
func=function(P,M)P.gameEnv.sequence=M.list[M.sel]end,
func=function(P,O)P.gameEnv.sequence=O end,
unranked=true,
},
{no=20,id="PS",name="pushSpeed",
key="n",x=800,y=470,color="blue",
list={.5,1,2,3,5,15,1e99},
func=function(P,M)P.gameEnv.pushSpeed=M.list[M.sel]end,
func=function(P,O)P.gameEnv.pushSpeed=O end,
unranked=true,
},
{no=21,id="BN",name="boneBlock",
key="m",x=920,y=470,color="blue",
list={"on","off"},
func=function(P,M)P.gameEnv.bone=M.sel==1 end,
func=function(P,O)P.gameEnv.bone=O=="on"end,
},
}
for i=1,#MODOPT do

View File

@@ -1,6 +1,5 @@
local gc=love.graphics
local sin,min=math.sin,math.min
local Timer=love.timer.getTime
return{
color=COLOR.red,
env={
@@ -43,7 +42,7 @@ return{
end
--Figures
local t=Timer()
local t=TIME()
gc.setColor(1,1,1,.5+.2*sin(t))
gc.draw(IMG.hbm,-276,-86,0,1.5)
gc.draw(IMG.electric,476,142,0,2.6)

View File

@@ -1,5 +1,5 @@
local gc=love.graphics
local Timer=love.timer.getTime
local TIME=love.timer.getTime
local int,ceil,rnd=math.floor,math.ceil,math.random
local max,min,sin=math.max,math.min,math.sin
local format=string.format
@@ -40,7 +40,7 @@ local function drawField(P)
gc.setColor(1,1,1,min(V[j][i]*.05,1))
Draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
elseif rep then
gc.setColor(1,1,1,.3+.08*sin(.5*(j-i)+Timer()*4))
gc.setColor(1,1,1,.3+.08*sin(.5*(j-i)+TIME()*4))
gc.rectangle("fill",30*i-30,-30*j,30,30)
end
end
@@ -307,6 +307,7 @@ function draw.norm(P)
local _
local ENV=P.gameEnv
local FBN,FUP=P.fieldBeneath,P.fieldUp
local t=TIME()
gc.push("transform")
gc.translate(P.x,P.y)gc.scale(P.size)
@@ -338,7 +339,7 @@ function draw.norm(P)
drawField(P)
--Draw spawn line
gc.setColor(1,sin(Timer())*.4+.5,0,.5)
gc.setColor(1,sin(t)*.4+.5,0,.5)
gc.setLineWidth(4)
gc.line(0,-600-FBN,300,-600-FBN)
@@ -408,9 +409,9 @@ function draw.norm(P)
gc.rectangle("fill",303,599-h-bar,11,bar*(1-A.countdown/A.cd0))
else
--Warning
local t=math.sin((Timer()-i)*30)*.5+.5
local a=math.sin((t-i)*30)*.5+.5
local c1,c2=attackColor[A.lv][1],attackColor[A.lv][2]
gc.setColor(c1[1]*t+c2[1]*(1-t),c1[2]*t+c2[2]*(1-t),c1[3]*t+c2[3]*(1-t))
gc.setColor(c1[1]*a+c2[1]*(1-a),c1[2]*a+c2[2]*(1-a),c1[3]*a+c2[3]*(1-a))
gc.rectangle("fill",303,599-h,11,-bar)
end
else
@@ -429,7 +430,7 @@ function draw.norm(P)
gc.setColor(P.b2b<40 and COLOR.white or P.b2b<=1e3 and COLOR.lRed or COLOR.lBlue)
gc.rectangle("fill",-14,599,11,-a*.5)
gc.setColor(1,1,1)
if Timer()%.5<.3 then
if t%.5<.3 then
gc.rectangle("fill",-15,b<40 and 578.5 or 98.5,13,3)
end
@@ -499,19 +500,19 @@ function draw.norm(P)
--FinesseCombo
if P.finesseCombo>2 then
_=P.finesseComboTime
local T=P.finesseCombo.."x"
local str=P.finesseCombo.."x"
if _>0 then
gc.setColor(1,1,1,_*.2)
gc.print(T,20,570)
gc.print(str,20,570)
gc.setColor(1,1,1,1.2-_*.1)
gc.push("transform")
gc.translate(20,600)
gc.scale(1+_*.08)
gc.print(T,0,-30)
gc.print(str,0,-30)
gc.pop()
else
gc.setColor(1,1,1)
gc.print(T,20,570)
gc.print(str,20,570)
end
end
@@ -544,7 +545,7 @@ function draw.norm(P)
--Draw current mission
setFont(35)
if ENV.missionKill then
gc.setColor(1,.7+.2*sin(Timer()*6.26),.4)
gc.setColor(1,.7+.2*sin(t*6.26),.4)
else
gc.setColor(1,1,1)
end
@@ -553,10 +554,10 @@ function draw.norm(P)
--Draw next mission
setFont(20)
for i=1,3 do
local t=L[P.curMission+i]
if t then
t=missionEnum[t]
gc.print(t,87-28*i,117)
local m=L[P.curMission+i]
if m then
m=missionEnum[m]
gc.print(m,87-28*i,117)
else
break
end

View File

@@ -3,7 +3,7 @@ local prepareSequence=require"parts/player/prepareSequence"
local gameEnv0=require"parts/player/gameEnv0"
local mt=love.math
local rnd,max,min=math.random,math.max,math.min
local rnd,max=math.random,math.max
local ins=table.insert
local PLY={
@@ -216,7 +216,7 @@ local function loadGameEnv(P)--Load gameEnv
end
if not ENV.noMod then
for _,M in next,GAME.mod do
M.func(P,M)
M.func(P,M.list[M.sel])
end
end
end

View File

@@ -1,12 +1,11 @@
local gc=love.graphics
local Timer=love.timer.getTime
local ins,rem=table.insert,table.remove
local max,min=math.max,math.min
local texts={}
local remain--People in chat room
local scroll--Bottom message no.
local scrollPos--Scroll up length
local newMessage=false--If there is a new message
local heartBeatTimer
local escapeTimer=0
@@ -23,7 +22,7 @@ local function sendMessage()
end
local function clearHistory()
while #texts>1 do rem(texts)end
scroll=1
scrollPos=1
SFX.play("fall")
collectgarbage()
end
@@ -39,7 +38,7 @@ function scene.sceneInit()
elseif #texts>1 and texts[#texts][1]~=COLOR.dG then
ins(texts,{COLOR.dG,text.chatHistory})
end
scroll=#texts
scrollPos=#texts
TASK.new(focusAtTextbox)--Widgets are not initialized, so active after 1 frame
BG.set("none")
wsConnect(
@@ -58,19 +57,19 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(k)
if k=="up"then
scroll=max(scroll-1,min(#texts,12))
scrollPos=max(scrollPos-1,min(#texts,12))
elseif k=="down"then
scroll=min(scroll+1,#texts)
if scroll==#texts then
scrollPos=min(scrollPos+1,#texts)
if scrollPos==#texts then
newMessage=false
end
elseif k=="return"then
sendMessage()
elseif k=="escape"then
if Timer()-escapeTimer<.6 then
if TIME()-escapeTimer<.6 then
SCN.back()
else
escapeTimer=Timer()
escapeTimer=TIME()
LOG.print(text.chatQuit,COLOR.orange)
end
else
@@ -102,8 +101,8 @@ function scene.socketRead(mes)
COLOR.sky,mes:sub(sep+1),
})
end
if scroll==#texts-1 then
scroll=scroll+1
if scrollPos==#texts-1 then
scrollPos=scrollPos+1
else
SFX.play("spin_0",.8)
newMessage=true
@@ -124,8 +123,8 @@ function scene.draw()
gc.print(remain or"?",1205,10)
setFont(30)
for i=max(scroll-11,1),scroll do
gc.printf(texts[i],40,416-36*(scroll-i),1240)
for i=max(scrollPos-11,1),scrollPos do
gc.printf(texts[i],40,416-36*(scrollPos-i),1240)
end
--Slider
@@ -133,13 +132,13 @@ function scene.draw()
gc.setLineWidth(2)
gc.rectangle("line",10,30,20,420)
local len=420*12/#texts
gc.rectangle("fill",13,33+(414-len)*(scroll-12)/(#texts-12),14,len)
gc.rectangle("fill",13,33+(414-len)*(scrollPos-12)/(#texts-12),14,len)
end
--Draw
if newMessage and scroll~=#texts then
if newMessage and scrollPos~=#texts then
setFont(40)
gc.setColor(1,Timer()%.4<.2 and 1 or 0,0)
gc.setColor(1,TIME()%.4<.2 and 1 or 0,0)
gc.print("v",8,480)
end
end

View File

@@ -1,6 +1,5 @@
local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local int=math.floor
local find,sub=string.find,string.sub
@@ -132,14 +131,14 @@ function scene.draw()
--Field
setFont(40)
if initField and #FIELD>1 then
gc.setColor(1,1,int(Timer()*6.26)%2)
gc.setColor(1,1,int(TIME()*6.26)%2)
gc.print("+",275,300)
gc.print(#FIELD-1,300,300)
end
--Sequence
if #BAG>0 then
gc.setColor(1,1,int(Timer()*6.26)%2)
gc.setColor(1,1,int(TIME()*6.26)%2)
gc.print("#",330,545)
gc.print(#BAG,360,545)
end
@@ -149,7 +148,7 @@ function scene.draw()
--Sequence
if #MISSION>0 then
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(Timer()*6.26)%2)
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(TIME()*6.26)%2)
gc.print("#",610,545)
gc.print(#MISSION,640,545)
end

View File

@@ -1,6 +1,5 @@
local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local int,sin=math.floor,math.sin
local ins,rem=table.insert,table.remove
@@ -160,7 +159,7 @@ function scene.draw()
if N>0 then
gc.setColor(libColor[set[N]])
elseif L[i]>4 then
gc.setColor(COLOR.rainbow(i+Timer()*6.26))
gc.setColor(COLOR.rainbow(i+TIME()*6.26))
else
gc.setColor(COLOR.grey)
end
@@ -175,7 +174,7 @@ function scene.draw()
until i>j+1
--Draw cursor
gc.setColor(1,1,.4,.6+.4*sin(Timer()*6.26))
gc.setColor(1,1,.4,.6+.4*sin(TIME()*6.26))
gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset

View File

@@ -1,6 +1,5 @@
local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local sin=math.sin
local ins,rem=table.insert,table.remove
@@ -171,7 +170,7 @@ function scene.draw()
gc.print(#L,120,310)
--Draw cursor
gc.setColor(.5,1,.5,.6+.4*sin(Timer()*6.26))
gc.setColor(.5,1,.5,.6+.4*sin(TIME()*6.26))
gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local int,abs=math.floor,math.abs
local min,sin=math.min,math.sin
@@ -158,20 +157,20 @@ function scene.draw()
local list=result[1]and result or dict
gc.setColor(1,1,1)
local text=list[selected][4]
if #text>900 then
local t=list[selected][4]
if #t>900 then
setFont(15)
elseif #text>600 then
elseif #t>600 then
setFont(20)
elseif #text>400 then
elseif #t>400 then
setFont(25)
else
setFont(30)
end
gc.printf(text,306,180,950)
gc.printf(t,306,180,950)
setFont(30)
gc.setColor(1,1,1,.4+.2*sin(Timer()*4))
gc.setColor(1,1,1,.4+.2*sin(TIME()*4))
gc.rectangle("fill",20,143+35*(selected-scrollPos),280,35)
setFont(30)
@@ -193,10 +192,10 @@ function scene.draw()
gc.rectangle("line",20,180,280,526)
if waiting>0 then
local r=Timer()*2
local r=TIME()*2
local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1))
gc.draw(TEXTURE.miniBlock[R],785,140,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],785,140,TIME()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
end
end

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local sin=math.sin
@@ -10,23 +9,33 @@ function scene.sceneInit()
end
function scene.draw()
--Draw all texts
setFont(20)
gc.setColor(1,1,1)
for i=1,#text.help do
gc.printf(text.help[i],150,35*i+40,1000,"center")
end
--Lib used
setFont(15)
gc.print(text.used,30,330)
gc.draw(IMG.title,280,610,.1,1+.05*sin(Timer()*2.6),nil,206,35)
local t=TIME()
--Sponsor code
gc.draw(IMG.title,280,610,.1,1+.05*sin(t*2.6),nil,206,35)
gc.setLineWidth(3)
gc.rectangle("line",18,18,263,263)
gc.rectangle("line",1012,18,250,250)
--Group code
setFont(20)
mStr(text.group,640,490)
gc.setColor(1,1,1,sin(Timer()*20)*.3+.6)
--Support text
gc.setColor(1,1,1,sin(t*20)*.3+.6)
setFont(30)
mStr(text.support,150+sin(Timer()*4)*20,283)
mStr(text.support,1138-sin(Timer()*4)*20,270)
mStr(text.support,150+sin(t*4)*20,283)
mStr(text.support,1138-sin(t*4)*20,270)
end
scene.widgetList={

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local abs=math.abs
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
@@ -59,11 +58,11 @@ local titleTransform={
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(Timer()*3+626*i)*d,cos(Timer()*3+626*i)*d)
gc.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(Timer()*3+626*i)*d,-cos(Timer()*3+626*i)*d)
gc.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)
end,
function(t)
gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)
@@ -96,7 +95,7 @@ function scene.draw()
gc.pop()
if t2>=80 then
gc.setColor(1,1,1,.6+sin((t2-80)*.0626)*.3)
mText(drawableText.anykey,640,615+sin(Timer()*3)*5)
mText(drawableText.anykey,640,615+sin(TIME()*3)*5)
end
end

View File

@@ -1,6 +1,5 @@
local gc=love.graphics
local tc=love.touch
local Timer=love.timer.getTime
local max,min,sin=math.max,math.min,math.sin
@@ -224,14 +223,14 @@ function scene.draw()
gc.setColor(.4,.4,.4)
gc.rectangle("fill",0,0,440,260)
local T=Timer()
local t=TIME()
gc.setColor(COLOR.dCyan)
mDraw(studioLogo,220,Y*.2-1204)
mDraw(studioLogo,220,-Y*.2+1476)
gc.setColor(COLOR.cyan)
mDraw(studioLogo,220+4*sin(T*10),136+4*sin(T*6))
mDraw(studioLogo,220+4*sin(T*12),136+4*sin(T*8))
mDraw(studioLogo,220+4*sin(t*10),136+4*sin(t*6))
mDraw(studioLogo,220+4*sin(t*12),136+4*sin(t*8))
gc.setColor(COLOR.dCyan)
mDraw(studioLogo,219,137)

View File

@@ -1,11 +1,8 @@
local gc=love.graphics
local Timer=love.timer.getTime
local mStr=mStr
local int=math.floor
local rnd=math.random
local int,rnd=math.floor,math.random
local format=string.format
local mStr=mStr
local scene={}
@@ -120,11 +117,11 @@ local function tapBoard(x,y,key)
move=move+moves
if state==0 then
state=1
startTime=Timer()
startTime=TIME()
end
if checkBoard(b)then
state=2
time=Timer()-startTime
time=TIME()-startTime
if time<1 then LOG.print("不是人",COLOR.lBlue)
elseif time<2 then LOG.print("还是人",COLOR.lBlue)
elseif time<3 then LOG.print("神仙",COLOR.lBlue)
@@ -203,7 +200,7 @@ end
function scene.update()
if state==1 then
time=Timer()-startTime
time=TIME()-startTime
end
end

View File

@@ -1,8 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local rnd=math.random
local format=string.format
local mStr=mStr
local levels={
@@ -63,9 +61,9 @@ function scene.keyDown(key)
SFX.play("move")
if progress==2 then
state=1
startTime=Timer()
startTime=TIME()
elseif progress>#targetString then
time=Timer()-startTime
time=TIME()-startTime
state=2
SFX.play("reach")
end
@@ -87,7 +85,7 @@ end
function scene.update()
if state==1 then
frameKeyCount=0
time=Timer()-startTime
time=TIME()-startTime
end
end

View File

@@ -1,6 +1,5 @@
local gc=love.graphics
local int=math.floor
local Timer=love.timer.getTime
local lines={
{1,2,3},
@@ -28,7 +27,7 @@ local function restart()
curX,curx=nil
round=0
target=false
placeTime=Timer()
placeTime=TIME()
gameover=false
for X=1,9 do
score[X]=false
@@ -61,7 +60,7 @@ local function place(X,x)
SFX.play("move")
lastX,lastx=X,x
curX,curx=nil
placeTime=Timer()
placeTime=TIME()
if checkBoard(board[X],round)then
score[X]=round
if checkBoard(score,round)then
@@ -112,7 +111,7 @@ function scene.draw()
gc.rectangle("fill",0,0,90,90)
--Draw target area
gc.setColor(1,1,1,math.sin((Timer()-placeTime)*5)/5+.2)
gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)/5+.2)
if target then
gc.rectangle("fill",(target-1)%3*30,int((target-1)/3)*30,30,30)
elseif not gameover then
@@ -165,7 +164,7 @@ function scene.draw()
--Draw last pos
if lastX then
gc.setColor(.5,1,.4,.8)
local r=.5+.5*math.sin(Timer()*6.26)
local r=.5+.5*math.sin(TIME()*6.26)
gc.rectangle("line",(lastX-1)%3*30+(lastx-1)%3*10-r,int((lastX-1)/3)*30+int((lastx-1)/3)*10-r,10+2*r,10+2*r)
end
gc.pop()

View File

@@ -1,14 +1,11 @@
local gc=love.graphics
local ms=love.mouse
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local int=math.floor
local rnd=math.random
local int,rnd=math.floor,math.random
local format=string.format
local rem=table.remove
local setFont=setFont
local mStr=mStr
local scene={}
@@ -52,7 +49,7 @@ local function tapBoard(x,y)
if state==0 then
newBoard()
state=1
startTime=Timer()
startTime=TIME()
progress=0
elseif state==1 then
local X=int((x-320)/640*R)
@@ -63,7 +60,7 @@ local function tapBoard(x,y)
if progress<R^2 then
SFX.play("lock")
else
time=Timer()-startTime+mistake
time=TIME()-startTime+mistake
state=2
SFX.play("reach")
end
@@ -121,7 +118,7 @@ end
function scene.update()
if state==1 then
time=Timer()-startTime+mistake
time=TIME()-startTime+mistake
end
end

View File

@@ -1,7 +1,6 @@
local mt=love.math
local gc=love.graphics
local ms,kb,tc=love.mouse,love.keyboard,love.touch
local Timer=love.timer.getTime
local max,min=math.max,math.min
local int,abs=math.floor,math.abs
@@ -217,7 +216,7 @@ function scene.draw()
if c then
gc.setColor(c)
else
c=.5+sin(Timer()*6.26)*.2
c=.5+sin(TIME()*6.26)*.2
gc.setColor(c,c,c)
end

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local sin=math.sin
@@ -63,13 +62,14 @@ function scene.draw()
gc.draw(IMG.title,840,220,nil,1.5,nil,206,35)
if BGM.nowPlay then
setFont(50)
gc.setColor(sin(Timer()*.5)*.2+.8,sin(Timer()*.7)*.2+.8,sin(Timer())*.2+.8)
local t=TIME()
gc.setColor(sin(t*.5)*.2+.8,sin(t*.7)*.2+.8,sin(t)*.2+.8)
gc.print(BGM.nowPlay,710,500)
local t=-Timer()%2.3/2
if t<1 then
gc.setColor(1,1,1,t)
gc.draw(IMG.title_color,840,220,nil,1.5+.1-.1*t,1.5+.3-.3*t,206,35)
local a=-t%2.3/2
if a<1 then
gc.setColor(1,1,1,a)
gc.draw(IMG.title_color,840,220,nil,1.5+.1-.1*a,1.5+.3-.3*a,206,35)
end
end
end

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local int=math.floor
local sin,log=math.sin,math.log10
@@ -269,7 +268,7 @@ function scene.draw()
--Polygon
gc.push("transform")
gc.scale((3-2*T)*T)
gc.setColor(1,1,1,T*(.5+.3*sin(Timer()*6.26)))gc.polygon("line",standard)
gc.setColor(1,1,1,T*(.5+.3*sin(TIME()*6.26)))gc.polygon("line",standard)
gc.setColor(chartColor[1],chartColor[2],chartColor[3],T*.626)
for i=1,9,2 do
gc.polygon("fill",0,0,val[i],val[i+1],val[i+2],val[i+3])
@@ -287,7 +286,7 @@ function scene.draw()
--Texts
local C
_=Timer()%6.2832
_=TIME()%6.2832
if _>3.1416 then
gc.setColor(1,1,1,-T*sin(_))
setFont(35)

View File

@@ -1,6 +1,6 @@
local gc=love.graphics
local tc=love.touch
local Timer=love.timer.getTime
local TIME=TIME
local max,sin=math.max,math.sin
local log=math.log
@@ -254,10 +254,10 @@ function scene.update(dt)
end
local function drawAtkPointer(x,y)
local t=sin(Timer()*20)
local t=sin(TIME()*20)
gc.setColor(.2,.7+t*.2,1,.6+t*.4)
gc.circle("fill",x,y,25,6)
local a=Timer()*3%1*.8
local a=TIME()*3%1*.8
gc.setColor(0,.6,1,.8-a)
gc.circle("line",x,y,30*(1+a),6)
end
@@ -299,9 +299,9 @@ local function drawVirtualkey()
end
end
function scene.draw()
local t=TIME()
if MARKING then
setFont(25)
local t=Timer()
gc.setColor(1,1,1,.2+.1*(sin(3*t)+sin(2.6*t)))
mStr(text.marking,190,60+26*sin(t))
end
@@ -337,7 +337,7 @@ function scene.draw()
--Replaying
if GAME.replaying then
gc.setColor(1,1,Timer()%1>.5 and 1 or 0)
gc.setColor(1,1,t%1>.5 and 1 or 0)
mText(drawableText.replaying,410,17)
end

View File

@@ -1,6 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local int=math.floor
local scene={}
@@ -14,7 +12,7 @@ end
function scene.draw()
gc.setColor(1,1,1)
gc.draw(SKIN.curText[int(Timer()*2)%16+1],740,540,Timer()%6.28319,2,nil,15,15)
gc.draw(SKIN.curText[int(TIME()*2)%16+1],740,540,TIME()%6.28319,2,nil,15,15)
end
scene.widgetList={

View File

@@ -1,9 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local mStr=mStr
local int,sin=math.floor,math.sin
local mStr=mStr
local scene={}
@@ -92,7 +89,7 @@ function scene.gamepadDown(key)
end
function scene.draw()
local a=.3+sin(Timer()*15)*.1
local a=.3+sin(TIME()*15)*.1
if kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end
gc.rectangle("fill",
kb<11 and 240 or 840,

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local sin=math.sin
local scene={}
@@ -18,7 +17,7 @@ function scene.draw()
gc.draw(texture[color],x+30*j,y-30*i)
end
end end
gc.circle("fill",-10+140*N,340,sin(Timer()*10)+5)
gc.circle("fill",-10+140*N,340,sin(TIME()*10)+5)
end
gc.draw(texture[17],930,610,nil,2)
for i=1,5 do

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local Timer=love.timer.getTime
local sin=math.sin
local rnd=math.random
@@ -23,10 +22,10 @@ end
function scene.mouseDown(x,y)
if x>780 and x<980 and y>470 and jump==0 then
jump=10
local t=Timer()-last
local t=TIME()-last
if t>1 then
VOC.play((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg")
last=Timer()
last=TIME()
end
end
end
@@ -43,7 +42,7 @@ end
function scene.draw()
gc.setColor(1,1,1)
local t=Timer()
local t=TIME()
local _=jump
local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3
gc.translate(x,y)

View File

@@ -1,6 +1,5 @@
local gc=love.graphics
local ms=love.mouse
local Timer=love.timer.getTime
local int,sin=math.floor,math.sin
@@ -91,7 +90,7 @@ function scene.draw()
local d=snapUnit
if d>=10 then
gc.setLineWidth(3)
gc.setColor(1,1,1,sin(Timer()*4)*.1+.1)
gc.setColor(1,1,1,sin(TIME()*4)*.1+.1)
for i=1,1280/d-1 do
gc.line(d*i,0,d*i,720)
end

View File

@@ -1,9 +1,7 @@
local gc=love.graphics
local Timer=love.timer.getTime
local abs,int,sin=math.abs,math.floor,math.sin
local format=string.format
local mStr=mStr
local scene={}
@@ -88,12 +86,13 @@ function scene.draw()
gc.line(40,240+40*y,600,240+40*y)
end
gc.draw(IMG.title,260,615,.2+.04*sin(Timer()*3),nil,nil,206,35)
local t=TIME()
gc.draw(IMG.title,260,615,.2+.04*sin(t*3),nil,nil,206,35)
local r=Timer()*2
local r=t*2
local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1))
gc.draw(TEXTURE.miniBlock[R],680,50,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],680,50,t*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],680,300,0,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
end