整理代码习惯,常量字符串改用单引号,可能有遗漏

This commit is contained in:
MrZ626
2021-04-30 01:00:22 +08:00
parent 7676f32cf2
commit eda6c0d746
213 changed files with 2503 additions and 2499 deletions

View File

@@ -15,8 +15,8 @@ local ry=0--Rotation Y
local p1,p2--Player data
function scene.sceneInit()
BG.set("none")
BGM.play("way")
BG.set('none')
BGM.play('way')
state=0
bx,by=640,360
@@ -53,7 +53,7 @@ function scene.keyDown(key)
vx,vy=0,0
ry=0
p1.score,p2.score=0,0
SFX.play("hold")
SFX.play('hold')
elseif key=="w"or key=="s"then
p1.y0=false
elseif key=="up"or key=="down"then
@@ -119,7 +119,7 @@ function scene.update()
vx=-vx-(vx>0 and .05 or -.5)
vy=vy+d*.08+P.vy*.5
ry=P.vy
SFX.play("collect")
SFX.play('collect')
else
state=2
end
@@ -127,14 +127,14 @@ function scene.update()
if by<30 or by>690 then
by=by<30 and 30 or 690
vy,ry=-vy,-ry
SFX.play("collect")
SFX.play('collect')
end
elseif state==2 then--Game over
if bx<-120 or bx>1400 or by<-40 or by>760 then
P=bx>640 and p1 or p2
P.score=P.score+1
TEXT.show("+1",bx>1400 and 470 or 810,226,50,"score")
SFX.play("reach")
TEXT.show("+1",bx>1400 and 470 or 810,226,50,'score')
SFX.play('reach')
state=0
bx,by=640,360
@@ -159,15 +159,15 @@ function scene.draw()
--Draw ball & speed line
gc.setColor(1,1,1-abs(ry)*.16)
gc.circle("fill",bx,by,10)
gc.circle('fill',bx,by,10)
gc.setColor(1,1,1,.1)
gc.line(bx+vx*22,by+vy*22,bx+vx*30,by+vy*30)
--Draw pads
gc.setColor(1,.8,.8)
gc.rectangle("fill",130,p1.y-50,20,100)
gc.rectangle('fill',130,p1.y-50,20,100)
gc.setColor(.8,.8,1)
gc.rectangle("fill",1130,p2.y-50,20,100)
gc.rectangle('fill',1130,p2.y-50,20,100)
end
scene.widgetList={