@@ -754,9 +754,9 @@ function clienttest(dt) | |||||
clientinit = true | clientinit = true | ||||
end | end | ||||
udp:send(tostring(lastSentKey)) | udp:send(tostring(lastSentKey)) | ||||
print(lastSentKey) | |||||
print("SENT TO SERVER:" .. lastSentKey) | |||||
data = udp:receive() | data = udp:receive() | ||||
print(data) | |||||
--print(data) | |||||
if data then | if data then | ||||
local p = split(data, '|') | local p = split(data, '|') | ||||
for i = 1, maxBalls do | for i = 1, maxBalls do | ||||
@@ -765,7 +765,8 @@ function clienttest(dt) | |||||
print(p[2] + 0) | print(p[2] + 0) | ||||
lastSentKeyClient, ball[i].dy, player2.y, player1.y, player1score, player2score, player1nukescore, player2nukescore, confirmation = p[1], die, tonumber(p[3]), tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), p[9] | lastSentKeyClient, ball[i].dy, player2.y, player1.y, player1score, player2score, player1nukescore, player2nukescore, confirmation = p[1], die, tonumber(p[3]), tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), p[9] | ||||
end | end | ||||
end | |||||
end | |||||
print(confirmation .. " recieved " .. lastSentKeyClient) | |||||
end | end | ||||
function wallbreaker(x, y) | function wallbreaker(x, y) | ||||
@@ -961,9 +961,11 @@ function rules(query, i) | |||||
end | end | ||||
function clientsBaseGame(dt) | function clientsBaseGame(dt) | ||||
if confirmation == "up1" then | if confirmation == "up1" then | ||||
player1.RED = 1 | |||||
player1.RED = 0 | |||||
print("KEYS ARE: " .. confirmation .. " " .. lastSentKeyP2) | |||||
elseif confirmation == "up2" then | elseif confirmation == "up2" then | ||||
player2.RED = 1 | |||||
player2.RED = 0 | |||||
print("KEYS ARE: " .. confirmation .. " " .. lastSentKeyP1) | |||||
end | end | ||||
if gameMode == "reverse" then | if gameMode == "reverse" then | ||||
reversegame(dt) | reversegame(dt) | ||||
@@ -980,8 +982,10 @@ function clientsBaseGame(dt) | |||||
if t < shakeDuration then | if t < shakeDuration then | ||||
t = t + dt | t = t + dt | ||||
end | end | ||||
if ((confirmation == "up1" and love.keyboard.isDown(p1control.up)) or lastSentKeyP1 == p1control.up) then | if ((confirmation == "up1" and love.keyboard.isDown(p1control.up)) or lastSentKeyP1 == p1control.up) then | ||||
player1.dy = (paddle_SPEED + p2bonus) * -1 | player1.dy = (paddle_SPEED + p2bonus) * -1 | ||||
elseif ((confirmation == "up1" and love.keyboard.isDown(p1control.down)) or lastSentKeyP1 == p1control.down) then | elseif ((confirmation == "up1" and love.keyboard.isDown(p1control.down)) or lastSentKeyP1 == p1control.down) then | ||||
player1.dy = paddle_SPEED + p2bonus | player1.dy = paddle_SPEED + p2bonus | ||||
else | else | ||||