@@ -808,7 +808,7 @@ function nettest(dt) | |||||
end | end | ||||
if (ball[1].dx > 0 and ball[1].x >= 40) or (ball[i].dx <= 0 and ball.x > VIRTUAL_WIDTH - 40) then | |||||
if (ball[1].x > VIRTUAL_WIDTH/2) and gameState ~= "play" then | |||||
die = tonumber(p[2]) | die = tonumber(p[2]) | ||||
lastSentKeyClient, | lastSentKeyClient, | ||||
ball[1].dy, | ball[1].dy, | ||||
@@ -893,7 +893,7 @@ function clienttest(dt) | |||||
end | end | ||||
for i = 1, maxBalls do | for i = 1, maxBalls do | ||||
local die = tonumber(p[2]) | local die = tonumber(p[2]) | ||||
if (ball[i].dx <= 0 and ball.x < VIRTUAL_WIDTH - 40) or (ball[i].dx > 0 and ball.x < 40) then | |||||
if (ball[i].x <= VIRTUAL_WIDTH/2) or gameState ~= "play" then | |||||
lastSentKeyClient, ball[i].dy, player1.y, player1score, player2score, player1nukescore, player2nukescore, ball[i].x, ball[i].y, gameState, ball[i].dx, ballSpeed, paddle_SPEED = p[1], die, tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), tonumber(p[9]), tonumber(p[10]), p[11], tonumber(p[12]), tonumber(p[13]), tonumber(p[14]) | lastSentKeyClient, ball[i].dy, player1.y, player1score, player2score, player1nukescore, player2nukescore, ball[i].x, ball[i].y, gameState, ball[i].dx, ballSpeed, paddle_SPEED = p[1], die, tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), tonumber(p[9]), tonumber(p[10]), p[11], tonumber(p[12]), tonumber(p[13]), tonumber(p[14]) | ||||
else | else | ||||
lastSentKeyClient = p[1] | lastSentKeyClient = p[1] | ||||
@@ -401,8 +401,11 @@ function goalManager() | |||||
gameState = "done" | gameState = "done" | ||||
TEXT = "Player 2 Won!" | TEXT = "Player 2 Won!" | ||||
else | else | ||||
gameState = "1serve" | |||||
serveBot() | |||||
if globalState ~= "clienttest" or (globalState == "clienttest" and gameState == "1serve") then | |||||
gameState = "1serve" | |||||
serveBot() | |||||
ball[i]:reset(i) | |||||
end | |||||
end | end | ||||
end | end | ||||
@@ -439,11 +442,14 @@ function goalManager() | |||||
gameState = "done" | gameState = "done" | ||||
TEXT = "Player 1 Won!" | TEXT = "Player 1 Won!" | ||||
else | else | ||||
if globalState ~= "nettest" or (globalState == "nettest" and gameState == "2serve") then | |||||
gameState = "2serve" | gameState = "2serve" | ||||
serveBot() | serveBot() | ||||
ball[i]:reset(i) | ball[i]:reset(i) | ||||
end | |||||
end | end | ||||
end | end | ||||
sounds["score"]:play() | sounds["score"]:play() | ||||