注释后加空格

联网稍微推进
This commit is contained in:
MrZ_26
2022-10-03 02:43:51 +08:00
parent 06f4bb4e1a
commit f8d17b23b6
121 changed files with 1628 additions and 1622 deletions

View File

@@ -8,11 +8,11 @@ local rnd=math.random
local scene={}
local state
local bx,by=640,360--Ball posotion
local vx,vy=0,0--Ball velocity
local ry=0--Rotation Y
local bx,by=640,360-- Ball posotion
local vx,vy=0,0-- Ball velocity
local ry=0-- Rotation Y
local p1,p2--Player data
local p1,p2-- Player data
function scene.sceneInit()
BG.set('none')
@@ -70,9 +70,9 @@ end
function scene.touchMove(x,y)(x<640 and p1 or p2).y0=y end
function scene.mouseMove(x,y)(x<640 and p1 or p2).y0=y end
--Rect Area X:150~1130 Y:20~700
-- Rect Area X:150~1130 Y:20~700
function scene.update()
--Update pads
-- Update pads
local P=p1
while P do
if P.y0 then
@@ -105,7 +105,7 @@ function scene.update()
P=P==p1 and p2
end
--Update ball
-- Update ball
bx,by=bx+vx,by+vy
if ry~=0 then
if ry>0 then
@@ -116,7 +116,7 @@ function scene.update()
vy=vy+.1
end
end
if state==1 then--Playing
if state==1 then-- Playing
if bx<160 or bx>1120 then
P=bx<160 and p1 or p2
local d=by-P.y
@@ -134,7 +134,7 @@ function scene.update()
vy,ry=-vy,-ry
SFX.play('collect')
end
elseif state==2 then--Game over
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
@@ -150,25 +150,25 @@ function scene.update()
end
function scene.draw()
--Draw score
-- Draw score
gc.setColor(.4,.4,.4)
FONT.set(100)
GC.mStr(p1.score,470,20)
GC.mStr(p2.score,810,20)
--Draw boundary
-- Draw boundary
gc.setColor(COLOR.Z)
gc.setLineWidth(4)
gc.line(134,20,1146,20)
gc.line(134,700,1146,700)
--Draw ball & speed line
-- Draw ball & speed line
gc.setColor(1,1,1-abs(ry)*.16)
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
-- Draw pads
gc.setColor(1,.8,.8)
gc.rectangle('fill',134,p1.y-50,16,100)
gc.setColor(.8,.8,1)