@@ -9,6 +9,7 @@ function eball:init(x, y, width, height) | |||
self.dy = math.random(-1, 1) | |||
self.dx = 1 | |||
self.disabled = false | |||
end | |||
function eball:collides(paddle) | |||
@@ -39,6 +40,7 @@ else | |||
else | |||
self.dx = ball_DIR | |||
end | |||
self.disabled = false | |||
self.x = VIRTUAL_WIDTH /2 - 2 | |||
self.y = VIRTUAL_HEIGHT /2 - 2 | |||
self.dy = math.random(-1, 1) | |||
@@ -79,8 +81,10 @@ function eball:update(dt) | |||
else | |||
potentialnuke2 = 0 | |||
end | |||
if self.disabled == false then | |||
self.x = self.x + ballSpeed * self.dx * dt | |||
self.y = self.y + ballSpeed * self.dy * dt | |||
self.y = self.y + ballSpeed * self.dy * dt | |||
end | |||
end | |||
function eball:render(color) | |||
@@ -28,6 +28,7 @@ hitNum = {} | |||
hitNum[1] = 0 | |||
hitNum[2] = 0 | |||
hitNum[3] = 0 | |||
confirmation = "disconnected" | |||
hitNum[4] = 0 | |||
p1bonus = 0 | |||
p2bonus = 0 | |||
@@ -68,7 +69,9 @@ craz = 0 | |||
AI_LEVEL = 500 | |||
isFullscreen = 0 | |||
prtext = "Easy" | |||
lastSentKey = "c" | |||
MAP_TYPE = 0 | |||
lastSentKeyClient = "c" | |||
difficultyl = 300 | |||
req = "pp" | |||
ballSet = 200 | |||
@@ -95,7 +98,7 @@ function balancer() | |||
if (player2score == 9 or player1score == 9) then | |||
shakeDuration = 5 | |||
if debug then | |||
print("Shaking set to match almost over") | |||
--print("Shaking set to match almost over") | |||
end | |||
end | |||
if (player1score < player2score) then | |||
@@ -140,7 +143,7 @@ function love.load() | |||
configsave = io.open("config.lua", "w") | |||
shader = love.graphics.newShader(shader_code) | |||
time_1 = 0 | |||
print("Debug active") | |||
--print("Debug active") | |||
--load | |||
testwalls = love.filesystem.load("save.lua")() | |||
@@ -188,6 +191,28 @@ function love.load() | |||
end | |||
) | |||
) | |||
table.insert( | |||
buttons, | |||
newButton( | |||
"Online Test", | |||
function() | |||
globalState = "nettest" | |||
AGAINST_AI = 0 | |||
gameState = "1serve" | |||
end | |||
) | |||
) | |||
table.insert( | |||
buttons, | |||
newButton( | |||
"Client Test", | |||
function() | |||
globalState = "clienttest" | |||
AGAINST_AI = 0 | |||
gameState = "1serve" | |||
end | |||
) | |||
) | |||
table.insert( | |||
buttons, | |||
newButton( | |||
@@ -548,7 +573,7 @@ function love.load() | |||
"Reverse Play", | |||
function() | |||
gameState = "1serve" | |||
globalState = "reverse" | |||
gameMode = "reversegame" | |||
end | |||
) | |||
) | |||
@@ -679,13 +704,67 @@ function love.update(dt) | |||
if globalState == "base" then | |||
basegame(dt) | |||
end | |||
if globalState == "reverse" then | |||
reversegame(dt) | |||
end | |||
if globalState == "menu" then | |||
debugCheck(dt) | |||
end | |||
if globalState == "nettest" then | |||
basegame(dt) | |||
nettest(dt) | |||
end | |||
if globalState == "clienttest" then | |||
if confirmation ~= "disconnected" then | |||
clientsBaseGame(dt) | |||
end | |||
clienttest(dt) | |||
end | |||
end | |||
serverinit = false | |||
clientinit = false | |||
function nettest(dt) | |||
if serverinit == false then | |||
local socket = require('socket') | |||
udp = socket.udp() | |||
udp:setsockname('localhost', 142) | |||
udp:settimeout(0) | |||
serverinit = true | |||
end | |||
data, msg_or_ip, port_or_nil = udp:receivefrom() | |||
if data then | |||
print(data .. "FROM " .. msg_or_ip) | |||
end | |||
if data then | |||
local p = split(data, '|') | |||
lastSentKeyClient = p[1] | |||
for i = 1, maxBalls do | |||
print (tostring(ball[i].dy)) | |||
udp:sendto(tostring(lastSentKey) ..'|'.. tostring(ball[i].dy) .. '|' .. tostring(player2.y) .. '|' .. tostring(player1.y) .. '|' .. tostring(player1score) .. '|' .. tostring(player2score) .. '|' .. tostring(player1nukescore) .. '|' .. tostring(player2nukescore), msg_or_ip, port_or_nil) | |||
print("SENT: " .. lastSentKey) | |||
end | |||
end | |||
end | |||
function clienttest(dt) | |||
if clientinit == false then | |||
local socket = require "socket" | |||
local address, port = "45.76.95.31", 12345 | |||
udp = socket.udp() | |||
udp:setpeername(address, port) | |||
udp:settimeout(0) | |||
clientinit = true | |||
end | |||
udp:send(tostring(lastSentKey)) | |||
print(lastSentKey) | |||
data = udp:receive() | |||
print(data) | |||
if data then | |||
local p = split(data, '|') | |||
for i = 1, maxBalls do | |||
local die = tonumber(p[2]) | |||
print(p[2]) | |||
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] | |||
end | |||
end | |||
end | |||
function wallbreaker(x, y) | |||
if (gameState == "editor") then | |||
@@ -806,6 +885,7 @@ function dangerChecker() --CHECK IF CONTROLS ARE DUPLICATING | |||
end | |||
end | |||
function love.keypressed(key) | |||
lastSentKey = key | |||
if gameState == "assign" then | |||
if (req == "p1up") then | |||
p1control.up = key | |||
@@ -904,6 +984,9 @@ end | |||
function love.keyreleased(key) | |||
currentKey = " " | |||
if lastSentKey == key then | |||
lastSentKey = "g" | |||
end | |||
end | |||
function speedSetter(requesttype) | |||
if (requesttype == "ball") then | |||
@@ -1208,13 +1291,13 @@ function love.wheelmoved(x, y) | |||
end | |||
function serveBot() --THIS IS USED TO CHANGE TEXT/BALL DIRECTION ON DIFFERENT SERVES | |||
print("servebot called") | |||
--print("servebot called") | |||
if (gameState == "1serve") then | |||
updateTEXT = "" | |||
if (gameMode ~= "practice") then | |||
TEXT = "PLAYER 1, serve!(q)" | |||
end | |||
if (love.keyboard.isDown("q") or gameMode == "practice") then | |||
if ((globalState ~= "clienttest" and love.keyboard.isDown("q")) or gameMode == "practice" or (lastSentKeyClient == "q" and globalState == "clienttest")) then | |||
TEXT = "Lets Begin!" | |||
ball_DIR = 1 | |||
for i = 1, maxBalls do | |||
@@ -1236,7 +1319,7 @@ function serveBot() --THIS IS USED TO CHANGE TEXT/BALL DIRECTION ON DIFFERENT SE | |||
gameState = "play" | |||
end | |||
if (love.keyboard.isDown("p") and AGAINST_AI == 0) then | |||
if ((lastSentKeyClient == "p" or love.keyboard.isDown("p"))and AGAINST_AI == 0) then | |||
TEXT = "Lets Begin" | |||
ball_DIR = -1 | |||
for i = 1, maxBalls do | |||
@@ -1325,3 +1408,20 @@ function love.mousereleased(x, y, button) | |||
end | |||
end | |||
end | |||
function ballsAlive() | |||
for i = 1, maxBalls do | |||
if ball[i].disabled == false then | |||
print("Ball " .. i .. " is not disabled") | |||
return true | |||
end | |||
end | |||
return false | |||
end | |||
function split(s, delimiter) | |||
result = {} | |||
for match in (s..delimiter):gmatch("(.-)"..delimiter) do | |||
table.insert(result, match) | |||
end | |||
return result | |||
end |
@@ -1,8 +1,8 @@ | |||
function AI(target, ballCnt, diff) | |||
currentTarget = evaluateClosestBall(target); | |||
print("CLOSEST TARGET IS " .. currentTarget) | |||
--print("CLOSEST TARGET IS " .. currentTarget) | |||
if diff < 1200 then | |||
print ("Normal targeting ".. currentTarget .. " " .. target.x - ball[currentTarget].x .. " " .. ball[currentTarget].y - target.y) | |||
--print ("Normal targeting ".. currentTarget .. " " .. target.x - ball[currentTarget].x .. " " .. ball[currentTarget].y - target.y) | |||
if (ball[currentTarget].y - target.y >= target.height and target.x - ball[currentTarget].x < diff) then | |||
target.dy = AI_SPEED | |||
elseif (target.y - ball[currentTarget].y >= -target.height/2 and target.x - ball[currentTarget].x < diff) then | |||
@@ -11,11 +11,11 @@ function AI(target, ballCnt, diff) | |||
target.dy = 0 | |||
end | |||
else | |||
print("Complex targeting") | |||
--print("Complex targeting") | |||
neededTarget = predictBall(ball[currentTarget], target.x) | |||
if neededTarget ~= -1 then | |||
print("Calculated target = " .. neededTarget) | |||
--print("Calculated target = " .. neededTarget) | |||
if (target.y - neededTarget >= -target.height/2) then | |||
target.dy = -AI_SPEED | |||
elseif (neededTarget - target.y >= target.height*0.9) then | |||
@@ -78,27 +78,27 @@ function evaluateClosestBall(target) | |||
return ans | |||
end | |||
function predictBall(target, px) | |||
print("BALLSTATS:" .. target.x .. " " .. target.y) | |||
--print("BALLSTATS:" .. target.x .. " " .. target.y) | |||
if VIRTUAL_WIDTH - target.x < AI_SPEED then | |||
return target.y | |||
elseif target.dx > 0 then | |||
local ans = recursiveCalculations(px, target.x, target.y, target.dx, target.dy, 1) | |||
return ans | |||
else | |||
print("GO TO CENTER!!") | |||
--print("GO TO CENTER!!") | |||
return VIRTUAL_HEIGHT/2 | |||
end | |||
end | |||
function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
if (edy > 0) then | |||
print ("normal" .. ex .." " .. ey .. " " .. edx .. " " .. edy) | |||
--print ("normal" .. ex .." " .. ey .. " " .. edx .. " " .. edy) | |||
local time = (VIRTUAL_HEIGHT-ey) / (ballSpeed * edy) | |||
local distance = (ballSpeed * edx) * time | |||
print(distance .. " " .. edx .. " " .. time .. " " .. (px-ex)) | |||
--print(distance .. " " .. edx .. " " .. time .. " " .. (px-ex)) | |||
if distance > (px - ex) then | |||
local anstime = (px - ex) / (ballSpeed * edx) | |||
local bonus = (ballSpeed * edy) * anstime | |||
print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) | |||
--print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) | |||
-- if (ifspecial == 0) then | |||
return ey + bonus | |||
-- else | |||
@@ -112,10 +112,10 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
elseif edy == 0 then | |||
return ey | |||
else | |||
print ("inverse" .. ex .." " .. ey .. " " .. edx .. " " .. edy) | |||
--print ("inverse" .. ex .." " .. ey .. " " .. edx .. " " .. edy) | |||
local time = (ey) / math.abs((ballSpeed * edy)) | |||
local distance = (ballSpeed * edx) * time | |||
print(distance .. " " .. edx .. " " .. time .. " " .. (px-ex)) | |||
--print(distance .. " " .. edx .. " " .. time .. " " .. (px-ex)) | |||
--print("Why th efuck ") | |||
@@ -123,7 +123,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
if distance > (px - ex) then | |||
local anstime = (px - ex) / (ballSpeed * edx) | |||
local bonus = (ballSpeed * edy) * anstime | |||
print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) | |||
--print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) | |||
-- if (ifspecial == 0) then | |||
return ey + bonus | |||
-- else | |||
@@ -132,7 +132,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
else | |||
local emulatedx = ex + distance | |||
local emulatedy = 0 | |||
-- print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (VIRTUAL_WIDTH-ex)) | |||
----print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (VIRTUAL_WIDTH-ex)) | |||
return recursiveCalculations(px, emulatedx, emulatedy, edx, -edy, 0) | |||
end | |||
end |
@@ -1,4 +1,7 @@ | |||
function basegame(dt) | |||
if gameMode == "reverse" then | |||
reversegame(dt) | |||
end | |||
if player1nukescore > 300 then | |||
player1nukescore = 300 | |||
end | |||
@@ -11,7 +14,7 @@ function basegame(dt) | |||
if t < shakeDuration then | |||
t = t + dt | |||
end | |||
print("T = " .. tostring(t)) | |||
--print("T = " .. tostring(t)) | |||
serveBot() | |||
if gameState == 'play' then | |||
if (AGAINST_AI == 1) then | |||
@@ -25,20 +28,20 @@ function basegame(dt) | |||
player1.dy = 0 | |||
end | |||
if (AGAINST_AI == 0) then | |||
if (love.keyboard.isDown(p2control.up)) then | |||
if ((confirmation == "up2" and love.keyboard.isDown(p2control.up)) or lastSentKeyP2 == p2control.up) then | |||
player2.dy = (paddle_SPEED + p2bonus) * -1 | |||
elseif (love.keyboard.isDown(p2control.down)) then | |||
elseif ((confirmation == "up2" and love.keyboard.isDown(p2control.down)) or lastSentKeyP2 == p2control.down) then | |||
player2.dy = paddle_SPEED + p2bonus | |||
else | |||
player2.dy = 0 | |||
end | |||
end | |||
print(areanuclear .. striken .. player1score .. player2score) | |||
--print(areanuclear .. striken .. player1score .. player2score) | |||
for i = 1, maxBalls do | |||
if ball[i]:collides(player1) then | |||
if rules("p1hit", i) then | |||
if (areanuclear == 0 and striken == 1 and (player1score > ptw-2 or player2score > ptw-2)) then | |||
print("Calling animation") | |||
--print("Calling animation") | |||
superanimator("tensehit", 1) | |||
end | |||
if gameMode == "practice" then | |||
@@ -156,7 +159,7 @@ function basegame(dt) | |||
end | |||
end | |||
end | |||
if ball[i]:collides(player2) then | |||
if rules("p2hit", i) then | |||
--ameState = 'quickanim' | |||
t = 0 | |||
shakeDuration = 1 | |||
@@ -227,7 +230,7 @@ function basegame(dt) | |||
ball[i].dx = -ball[i].dx | |||
ball[i].x = player2.x - 30 | |||
if (love.keyboard.isDown(p2control.up) or AI_SPEED < 0) then | |||
if ((confirmation == "up2" and love.keyboard.isDown(p2control.up) ) or AI_SPEED < 0 or lastSentKeyP2 == p2control.up) then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = -1 | |||
@@ -240,7 +243,7 @@ function basegame(dt) | |||
elseif select == 5 then | |||
ball[i].dy = -2 | |||
end | |||
elseif love.keyboard.isDown(p2control.down) or AI_SPEED > 0 then | |||
elseif (confirmation == "up2" and love.keyboard.isDown(p2control.down)) or AI_SPEED > 0 or lastSentKeyP2 == p2control.down then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = 1 | |||
@@ -358,77 +361,86 @@ end | |||
function goalManager() | |||
for i = 1, maxBalls do | |||
if (ball[i].x < 0 - ballSpeed * 0.5) then | |||
if (gameMode ~= "practice") then | |||
sounds["score"]:play() | |||
end | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
player2score = player2score + 1 | |||
if (player2score == ptw and gameMode ~= "practice") then | |||
if (rules("p1miss", i)) then | |||
ball[i].disabled = true | |||
ball[i].x = 2000 | |||
if ballsAlive() == false then | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
for i = 1, maxBalls do | |||
ball[i]:reset(i) | |||
end | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 2 Won!" | |||
else | |||
if (player2score == ptw and gameMode ~= "practice") then | |||
for i = 1, maxBalls do | |||
ball[i]:reset(i) | |||
end | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 2 Won!" | |||
else | |||
gameState = "1serve" | |||
serveBot() | |||
for i = 1, maxBalls do | |||
end | |||
end | |||
player2score = player2score + 1 | |||
end | |||
if (rules("p2miss", i)) then | |||
ball[i].disabled = true | |||
ball[i].x = 2000 | |||
if ballsAlive() == false then | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
AI_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
AI_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
if (player1score == ptw) then | |||
ball[i]:reset(i) | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 1 Won!" | |||
else | |||
gameState = "2serve" | |||
serveBot() | |||
ball[i]:reset(i) | |||
end | |||
end | |||
end | |||
if (ball[i].x > VIRTUAL_WIDTH + ballSpeed * 0.5) then | |||
end | |||
sounds["score"]:play() | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
AI_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
AI_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
player1score = player1score + 1 | |||
if (player1score == ptw) then | |||
ball[i]:reset(i) | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 1 Won!" | |||
else | |||
gameState = "2serve" | |||
serveBot() | |||
ball[i]:reset(i) | |||
end | |||
end | |||
end | |||
end | |||
@@ -436,20 +448,20 @@ end | |||
function powerAvailability() | |||
if (player1nukescore >= 20 and player1nukescore < 140) then | |||
potentialstrike1 = 1 | |||
if (love.keyboard.isDown(p1control.super)) then | |||
if ((confirmation == "up1" and love.keyboard.isDown(p1control.super)) or (confirmation == "up2" and lastSentKeyP1 == p1control.super)) then | |||
player1striken = 1 | |||
player1reverbav = 0 | |||
end | |||
end | |||
if (player1nukescore >= 140) and timeIsSlow2 == false and timeIsSlow == false and maxBalls == 1 and ball[1].x < VIRTUAL_WIDTH / 2 and ball[1].dx < 0 then | |||
player1reverbav = 1 | |||
if love.keyboard.isDown(p1control.counter) then | |||
if ((confirmation == "up1" and love.keyboard.isDown(p1control.counter)) or (confirmation == "up2" and lastSentKeyP1 == p1control.counter)) then | |||
powerControl(1, "special") | |||
end | |||
end | |||
if (player1nukescore >= 200) then | |||
potentialnuke1 = 1 | |||
if (love.keyboard.isDown(p1control.super)) then | |||
if ((confirmation == "up1" and love.keyboard.isDown(p1control.super)) or (confirmation == "up2" and lastSentKeyP1 == p1control.super)) then | |||
sounds["nuke"]:play() | |||
if areanuclear == 1 then | |||
maxspeed = maxspeed + 50 | |||
@@ -478,7 +490,7 @@ function powerAvailability() | |||
if (player2nukescore >= 20 and player2nukescore <= 140) then | |||
potentialstrike2 = 1 | |||
if (AGAINST_AI == 0) then | |||
if (love.keyboard.isDown(p2control.super)) then | |||
if ((confirmation == "up2" and love.keyboard.isDown(p2control.super)) or lastSentKeyP2 == p2control.super) then | |||
player2striken = 1 | |||
player2reverbav = 0 | |||
end | |||
@@ -486,7 +498,7 @@ function powerAvailability() | |||
end | |||
if (player2nukescore >= 140) and timeIsSlow == false and timeIsSlow2 == false and maxBalls == 1 and ball[1].x > VIRTUAL_WIDTH / 2 and ball[1].dx > 0 then | |||
player2reverbav = 1 | |||
if love.keyboard.isDown(p2control.counter) then | |||
if (confirmation == "up2" and love.keyboard.isDown(p2control.counter)) or lastSentKeyP2 == p2control.counter then | |||
sounds["time"]:play() | |||
player2reverbav = false | |||
timeIsSlow2 = true | |||
@@ -499,7 +511,7 @@ function powerAvailability() | |||
end | |||
if (player2nukescore >= 200) then | |||
potentialnuke2 = 1 | |||
if (love.keyboard.isDown(p2control.super) and AGAINST_AI == 0) then | |||
if (((confirmation == "up2" and love.keyboard.isDown(p2control.super)) or lastSentKeyP2 == p2control.super) and AGAINST_AI == 0) then | |||
sounds["nuke"]:play() | |||
if areanuclear == 1 then | |||
maxspeed = maxspeed + 50 | |||
@@ -698,25 +710,25 @@ function baseDraw() | |||
love.graphics.translate(dx, dy) | |||
end | |||
if globalState == 'menu' then | |||
print("Drawing menuDraw") | |||
--print("Drawing menuDraw") | |||
if gameState == 'animation' then | |||
print("Drawing animation") | |||
--print("Drawing animation") | |||
intro() | |||
end | |||
if gameState ~= 'animation' then | |||
print("Drawing notanimtaion") | |||
--print("Drawing notanimtaion") | |||
love.graphics.setFont(scorefont) | |||
menuDraw() | |||
end | |||
end | |||
if globalState == 'base' or globalState == 'reverse' then | |||
if globalState == 'base' or globalState == 'reverse' or globalState == 'nettest' or globalState == 'clienttest' then | |||
love.graphics.setFont(smallfont) | |||
if gameState == 'nuclearExplosion' then | |||
nuclearDraw() | |||
end | |||
if gameState == 'play' or gameState == '1serve' or gameState == '2serve' or gameState == 'done' then | |||
print("Drawing normally") | |||
--print("Drawing normally") | |||
normalDraw() | |||
end | |||
@@ -906,4 +918,255 @@ function hitIdentifier() | |||
end | |||
end | |||
end | |||
end | |||
function rules(query, i) | |||
if query == "p1hit" then | |||
if gameMode == "normal" then | |||
return ball[i]:collides(player1) | |||
elseif gameMode == "reversegame" then | |||
return ball[i].x < 0 and ball[i].disabled == false | |||
end | |||
end | |||
if query == "p2hit" then | |||
if gameMode == "normal" then | |||
return ball[i]:collides(player2) | |||
elseif gameMode == "reversegame" then | |||
return ball[i].x > VIRTUAL_WIDTH-10 and ball[i].disabled == false | |||
end | |||
end | |||
if query == "p1miss" then | |||
if gameMode == "reversegame" then | |||
return ball[i]:collides(player1) | |||
elseif gameMode == "normal" then | |||
return ball[i].x < 0 and ball[i].disabled == false | |||
end | |||
end | |||
if query == "p2miss" then | |||
if gameMode == "reversegame" then | |||
return ball[i]:collides(player2) | |||
elseif gameMode == "normal" then | |||
return ball[i].x > VIRTUAL_WIDTH-10 and ball[i].disabled == false | |||
end | |||
end | |||
end | |||
function clientsBaseGame(dt) | |||
if gameMode == "reverse" then | |||
reversegame(dt) | |||
end | |||
if player1nukescore > 300 then | |||
player1nukescore = 300 | |||
end | |||
if player2nukescore > 300 then | |||
player2nukescore = 300 | |||
end | |||
speedControl() | |||
balancer() | |||
if t < shakeDuration then | |||
t = t + dt | |||
end | |||
if (lastSentKeyClient == p1control.up) then | |||
player1.dy = (paddle_SPEED + p1bonus) * -1 | |||
elseif (lastSentKeyClient == p1control.down) then | |||
player1.dy = paddle_SPEED + p1bonus | |||
else | |||
player1.dy = 0 | |||
end | |||
--print("T = " .. tostring(t)) | |||
serveBot() | |||
if gameState == 'play' then | |||
if (AGAINST_AI == 1) then | |||
AI(player2, maxBalls, AI_LEVEL) | |||
end | |||
--print(areanuclear .. striken .. player1score .. player2score) | |||
for i = 1, maxBalls do | |||
if rules("p1hit", i) then | |||
if (areanuclear == 0 and striken == 1 and (player1score > ptw-2 or player2score > ptw-2)) then | |||
--print("Calling animation") | |||
superanimator("tensehit", 1) | |||
end | |||
if gameMode == "practice" then | |||
player1score = player1score + 1 | |||
end | |||
t = 0 | |||
if (ballSpeed > 200) then | |||
shakeMagnitude = ballSpeed / 200 | |||
else | |||
shakeMagnitude = 0 | |||
end | |||
shakeDuration = 1 | |||
randomtext = love.math.random(1, #textphrases) | |||
TEXT = textphrases[randomtext] | |||
soundtype = love.math.random(1, 1.2) | |||
if (player1striken == 1) then | |||
TEXT = "PLAYER 1 STRIKES" | |||
ballSpeed = ballSpeed + player1nukescore | |||
potentialnuke1 = 0 | |||
player1striken = 0 | |||
player1nukescore = 0 | |||
potentialstrike1 = 0 | |||
striken = 1 | |||
if areanuclear == 0 then | |||
sounds["striking"]:setPitch(ballSpeed / 250) | |||
sounds["striking"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
superanimator("tensehit", 1) | |||
else | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
end | |||
if (striken == 1) then | |||
player1nukescore = player1nukescore * 1.2 | |||
if (synctype == 0) then | |||
paddle_SPEED = paddle_SPEED * 1.10 | |||
elseif (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
if (synctype == 0) then | |||
AI_SPEED = AI_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
AI_SPEED = ballSpeed * 1.1 / 10 | |||
end | |||
ballSpeed = ballSpeed * 1.10 | |||
end | |||
player1nukescore = player1nukescore + 10 | |||
ball[i].dx = -ball[i].dx | |||
ball[i].x = player1.x + 30 | |||
end | |||
if rules("p2hit", i) then | |||
--ameState = 'quickanim' | |||
t = 0 | |||
shakeDuration = 1 | |||
if | |||
(areanuclear == 0 and | |||
(striken == 1 and (player1score > ptw-2 or player2score > ptw-2))) | |||
then | |||
superanimator("tensehit", 2) | |||
end | |||
if (ballSpeed > 200) then | |||
shakeMagnitude = ballSpeed / 200 | |||
else | |||
shakeMagnitude = 0 | |||
end | |||
randomtext = love.math.random(1, #textphrases) | |||
TEXT = textphrases[randomtext] | |||
soundtype = love.math.random(1, 1.2) | |||
if (player2striken == 1) then | |||
TEXT = "PLAYER 2 STRIKES" | |||
ballSpeed = ballSpeed + player2nukescore | |||
striken = 1 | |||
player2striken = 0 | |||
potentialnuke2 = 0 | |||
player2nukescore = 0 | |||
potentialstrike2 = 0 | |||
superanimator("tensehit", 2) | |||
if areanuclear == 0 then | |||
sounds["striking"]:setPitch(ballSpeed / 250) | |||
sounds["striking"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
elseif (striken == 1) then | |||
player2nukescore = player2nukescore * 1.5 | |||
if (synctype == 0) then | |||
paddle_SPEED = paddle_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
if (synctype == 0) then | |||
AI_SPEED = AI_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
AI_SPEED = ballSpeed * 1.1 / 10 | |||
end | |||
ballSpeed = ballSpeed * 1.10 | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
else | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
end | |||
player2nukescore = player2nukescore + 10 | |||
ball[i].dx = -ball[i].dx | |||
ball[i].x = player2.x - 30 | |||
end | |||
hitIdentifier() | |||
if ball[i].y <= 0 then | |||
soundtype = love.math.random(1, 5) | |||
sounds["wallhit"]:setPitch(ballSpeed / 250) | |||
sounds["wallhit"]:play() | |||
ball[i].y = 0 | |||
end | |||
-- -4 to account for the ball's size | |||
if ball[i].y >= VIRTUAL_HEIGHT - 40 then | |||
soundtype = love.math.random(1, 5) | |||
sounds["wallhit"]:setPitch(ballSpeed / 250) | |||
sounds["wallhit"]:play() | |||
ball[i].y = VIRTUAL_HEIGHT - 40 | |||
end | |||
--love.window.setTitle('Trying to update the ball') | |||
if timeIsSlow then | |||
if ballSpeed > originalSpeed / 3 then | |||
paddle_SPEED = 30 | |||
ballSpeed = ballSpeed / (1 + (dt * 2)) | |||
end | |||
player1nukescore = player1nukescore - (dt * 50) | |||
if player1nukescore < 1 or ball[1].dx > 0 then | |||
timeIsSlow = false | |||
player1reverbav = false | |||
ballSpeed = originalSpeed | |||
sounds["time"]:stop() | |||
paddle_SPEED = originalPaddle | |||
end | |||
end | |||
if timeIsSlow2 then | |||
if ballSpeed > originalSpeed / 3 then | |||
ballSpeed = ballSpeed / (1 + (dt * 2)) | |||
end | |||
player2nukescore = player2nukescore - (dt * 50) | |||
if player2nukescore < 1 or ball[1].dx < 0 then | |||
paddle_SPEED = 30 | |||
timeIsSlow2 = false | |||
player2reverbav = false | |||
ballSpeed = originalSpeed | |||
sounds["time"]:stop() | |||
paddle_SPEED = originalPaddle | |||
end | |||
end | |||
ball[i]:update(dt) | |||
end | |||
end | |||
goalManager() | |||
powerAvailability() | |||
player1:update(dt) | |||
player2:update(dt) | |||
end |
@@ -12,468 +12,4 @@ function reversegame(dt) | |||
elseif(player2.y > ball[1].y) then | |||
player2.y = player2.y - ballSpeed/50 | |||
end | |||
if player1nukescore > 300 then | |||
player1nukescore = 300 | |||
end | |||
if player2nukescore > 300 then | |||
player2nukescore = 300 | |||
end | |||
speedControl() | |||
balancer() | |||
if t < shakeDuration then | |||
t = t + dt | |||
end | |||
print("T = " .. tostring(t)) | |||
serveBot() | |||
if gameState == 'play' then | |||
if (AGAINST_AI == 1) then | |||
for i = 1, maxBalls do | |||
if (ball[i].y - player2.y >= 50 and player2.x - ball[i].x < AI_LEVEL) then | |||
player2.dy = AI_SPEED | |||
elseif (player2.y - ball[i].y >= -20 and player2.x - ball[i].x < AI_LEVEL) then | |||
player2.dy = -AI_SPEED | |||
else | |||
player2.dy = 0 | |||
end | |||
if | |||
difficultyl == 350 and player2reverbav == true and VIRTUAL_WIDTH - ball[i].x < 90 and | |||
math.abs(ball[i].y - player2.y) > 150 | |||
then | |||
sounds["time"]:play() | |||
player2reverbav = false | |||
timeIsSlow2 = true | |||
originalPaddle = paddle_SPEED | |||
originalSpeed = ballSpeed | |||
player2reverbav = 0 | |||
potentialnuke2 = 0 | |||
potentialstrike2 = 0 | |||
end | |||
if (player2nukescore > AI_STRIKEMOD and striken == 0) then | |||
player2striken = 1 | |||
elseif (player2nukescore > AI_NUKEMOD and striken == 1) then | |||
if (areanuclear == 1) then | |||
maxspeed = maxspeed + 50 | |||
end | |||
sounds["nuke"]:play() | |||
potentialstrike2 = 0 | |||
areanuclear = 1 | |||
ballSpeed = ballSpeed * 2 | |||
if (synctype == 0) then | |||
paddle_SPEED = paddle_SPEED * 2 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
if (synctype == 0) then | |||
AI_SPEED = AI_SPEED * 2.2 | |||
end | |||
if (synctype == 1) then | |||
AI_SPEED = ballSpeed * 1.1 / 10 | |||
end | |||
player2nukescore = 0 | |||
player2reverbav = 0 | |||
potentialnuke2 = 0 | |||
end | |||
end | |||
end | |||
if (love.keyboard.isDown(p1control.up)) then | |||
player1.dy = (paddle_SPEED + p1bonus) * -1 | |||
elseif (love.keyboard.isDown(p1control.down)) then | |||
player1.dy = paddle_SPEED + p1bonus | |||
else | |||
player1.dy = 0 | |||
end | |||
if (AGAINST_AI == 0) then | |||
if (love.keyboard.isDown(p2control.up)) then | |||
player2.dy = (paddle_SPEED + p2bonus) * -1 | |||
elseif (love.keyboard.isDown(p2control.down)) then | |||
player2.dy = paddle_SPEED + p2bonus | |||
else | |||
player2.dy = 0 | |||
end | |||
end | |||
print(areanuclear .. striken .. player1score .. player2score) | |||
for i = 1, maxBalls do | |||
print(ball[i].x .. "BALLS") | |||
if ball[i].x < 0 then | |||
if (areanuclear == 0 and striken == 1 and (player1score > ptw-2 or player2score > ptw-2)) then | |||
print("Calling animation") | |||
superanimator("tensehit", 1) | |||
end | |||
if gameMode == "practice" then | |||
player1score = player1score + 1 | |||
end | |||
t = 0 | |||
if (ballSpeed > 200) then | |||
shakeMagnitude = ballSpeed / 200 | |||
else | |||
shakeMagnitude = 0 | |||
end | |||
shakeDuration = 1 | |||
randomtext = love.math.random(1, #textphrases) | |||
TEXT = textphrases[randomtext] | |||
soundtype = love.math.random(1, 1.2) | |||
if (player1striken == 1) then | |||
TEXT = "PLAYER 1 STRIKES" | |||
ballSpeed = ballSpeed + player1nukescore | |||
potentialnuke1 = 0 | |||
player1striken = 0 | |||
player1nukescore = 0 | |||
potentialstrike1 = 0 | |||
striken = 1 | |||
if areanuclear == 0 then | |||
sounds["striking"]:setPitch(ballSpeed / 250) | |||
sounds["striking"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
superanimator("tensehit", 1) | |||
else | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
end | |||
if (striken == 1) then | |||
player1nukescore = player1nukescore * 1.2 | |||
if (synctype == 0) then | |||
paddle_SPEED = paddle_SPEED * 1.10 | |||
elseif (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
if (synctype == 0) then | |||
AI_SPEED = AI_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
AI_SPEED = ballSpeed * 1.1 / 10 | |||
end | |||
ballSpeed = ballSpeed * 1.10 | |||
end | |||
player1nukescore = player1nukescore + 10 | |||
ball[i].dx = -ball[i].dx | |||
ball[i].x = player1.x + 30 | |||
if (love.keyboard.isDown(p1control.up)) then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = -1 | |||
elseif select == 2 then | |||
ball[i].dy = -1.2 | |||
elseif select == 3 then | |||
ball[i].dy = -1.5 | |||
elseif select == 4 then | |||
ball[i].dy = -1.8 | |||
elseif select == 5 then | |||
ball[i].dy = -2 | |||
end | |||
elseif love.keyboard.isDown(p1control.down) then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = 1 | |||
elseif select == 2 then | |||
ball[i].dy = 1.2 | |||
elseif select == 3 then | |||
ball[i].dy = 1.5 | |||
elseif select == 4 then | |||
ball[i].dy = 1.8 | |||
elseif select == 5 then | |||
ball[i].dy = 2 | |||
end | |||
else | |||
if ball[i].dy < 0 then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = -1 | |||
elseif select == 2 then | |||
ball[i].dy = -1.2 | |||
elseif select == 3 then | |||
ball[i].dy = -1.5 | |||
elseif select == 4 then | |||
ball[i].dy = -1.8 | |||
elseif select == 5 then | |||
ball[i].dy = -2 | |||
end | |||
else | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = 1 | |||
elseif select == 2 then | |||
ball[i].dy = 1.2 | |||
elseif select == 3 then | |||
ball[i].dy = 1.5 | |||
elseif select == 4 then | |||
ball[i].dy = 1.8 | |||
elseif select == 5 then | |||
ball[i].dy = 2 | |||
end | |||
end | |||
end | |||
end | |||
if ball[i].x > VIRTUAL_WIDTH-10 then | |||
--ameState = 'quickanim' | |||
t = 0 | |||
shakeDuration = 1 | |||
if | |||
(areanuclear == 0 and | |||
(striken == 1 and (player1score > ptw-2 or player2score > ptw-2))) | |||
then | |||
superanimator("tensehit", 2) | |||
end | |||
if (ballSpeed > 200) then | |||
shakeMagnitude = ballSpeed / 200 | |||
else | |||
shakeMagnitude = 0 | |||
end | |||
randomtext = love.math.random(1, #textphrases) | |||
TEXT = textphrases[randomtext] | |||
soundtype = love.math.random(1, 1.2) | |||
if (player2striken == 1) then | |||
TEXT = "PLAYER 2 STRIKES" | |||
ballSpeed = ballSpeed + player2nukescore | |||
striken = 1 | |||
player2striken = 0 | |||
potentialnuke2 = 0 | |||
player2nukescore = 0 | |||
potentialstrike2 = 0 | |||
superanimator("tensehit", 2) | |||
if areanuclear == 0 then | |||
sounds["striking"]:setPitch(ballSpeed / 250) | |||
sounds["striking"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
elseif (striken == 1) then | |||
player2nukescore = player2nukescore * 1.5 | |||
if (synctype == 0) then | |||
paddle_SPEED = paddle_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
if (synctype == 0) then | |||
AI_SPEED = AI_SPEED * 1.10 | |||
end | |||
if (synctype == 1) then | |||
AI_SPEED = ballSpeed * 1.1 / 10 | |||
end | |||
ballSpeed = ballSpeed * 1.10 | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
else | |||
if areanuclear == 0 then | |||
sounds["beep"]:setPitch(ballSpeed / 250) | |||
sounds["beep"]:play() | |||
else | |||
sounds["nuclearhit"]:setPitch(1) | |||
sounds["nuclearhit"]:play() | |||
end | |||
end | |||
player2nukescore = player2nukescore + 10 | |||
ball[i].dx = -ball[i].dx | |||
ball[i].x = player2.x - 30 | |||
if (love.keyboard.isDown(p2control.up) or AI_SPEED < 0) then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = -1 | |||
elseif select == 2 then | |||
ball[i].dy = -1.2 | |||
elseif select == 3 then | |||
ball[i].dy = -1.5 | |||
elseif select == 4 then | |||
ball[i].dy = -1.8 | |||
elseif select == 5 then | |||
ball[i].dy = -2 | |||
end | |||
elseif love.keyboard.isDown(p2control.down) or AI_SPEED > 0 then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = 1 | |||
elseif select == 2 then | |||
ball[i].dy = 1.2 | |||
elseif select == 3 then | |||
ball[i].dy = 1.5 | |||
elseif select == 4 then | |||
ball[i].dy = 1.8 | |||
elseif select == 5 then | |||
ball[i].dy = 2 | |||
end | |||
else | |||
if ball[i].dy < 0 then | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = -1 | |||
elseif select == 2 then | |||
ball[i].dy = -1.2 | |||
elseif select == 3 then | |||
ball[i].dy = -1.5 | |||
elseif select == 4 then | |||
ball[i].dy = -1.8 | |||
elseif select == 5 then | |||
ball[i].dy = -2 | |||
end | |||
else | |||
select = math.random(1, 5) | |||
if select == 1 then | |||
ball[i].dy = 1 | |||
elseif select == 2 then | |||
ball[i].dy = 1.2 | |||
elseif select == 3 then | |||
ball[i].dy = 1.5 | |||
elseif select == 4 then | |||
ball[i].dy = 1.8 | |||
elseif select == 5 then | |||
ball[i].dy = 2 | |||
end | |||
end | |||
end | |||
end | |||
hitIdentifier() | |||
if ball[i].y <= 0 then | |||
soundtype = love.math.random(1, 5) | |||
sounds["wallhit"]:setPitch(ballSpeed / 250) | |||
sounds["wallhit"]:play() | |||
ball[i].y = 0 | |||
ball[i].dy = -ball[i].dy | |||
end | |||
-- -4 to account for the ball's size | |||
if ball[i].y >= VIRTUAL_HEIGHT - 40 then | |||
soundtype = love.math.random(1, 5) | |||
sounds["wallhit"]:setPitch(ballSpeed / 250) | |||
sounds["wallhit"]:play() | |||
ball[i].y = VIRTUAL_HEIGHT - 40 | |||
ball[i].dy = -ball[i].dy | |||
end | |||
--love.window.setTitle('Trying to update the ball') | |||
if timeIsSlow then | |||
if ballSpeed > originalSpeed / 3 then | |||
paddle_SPEED = 30 | |||
ballSpeed = ballSpeed / (1 + (dt * 2)) | |||
end | |||
player1nukescore = player1nukescore - (dt * 50) | |||
if player1nukescore < 1 or ball[1].dx > 0 then | |||
timeIsSlow = false | |||
player1reverbav = false | |||
ballSpeed = originalSpeed | |||
sounds["time"]:stop() | |||
paddle_SPEED = originalPaddle | |||
end | |||
end | |||
if timeIsSlow2 then | |||
if ballSpeed > originalSpeed / 3 then | |||
ballSpeed = ballSpeed / (1 + (dt * 2)) | |||
end | |||
player2nukescore = player2nukescore - (dt * 50) | |||
if player2nukescore < 1 or ball[1].dx < 0 then | |||
paddle_SPEED = 30 | |||
timeIsSlow2 = false | |||
player2reverbav = false | |||
ballSpeed = originalSpeed | |||
sounds["time"]:stop() | |||
paddle_SPEED = originalPaddle | |||
end | |||
end | |||
ball[i]:update(dt) | |||
end | |||
end | |||
goalManagerReverse() | |||
powerAvailability() | |||
player1:update(dt) | |||
player2:update(dt) | |||
end | |||
function goalManagerReverse() | |||
for i = 1, maxBalls do | |||
if (ball[i]:collides(player1)) then | |||
if (gameMode ~= "practice") then | |||
sounds["score"]:play() | |||
end | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
player2score = player2score + 1 | |||
if (player2score == ptw and gameMode ~= "practice") then | |||
for i = 1, maxBalls do | |||
ball[i]:reset(i) | |||
end | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 2 Won!" | |||
else | |||
gameState = "1serve" | |||
serveBot() | |||
for i = 1, maxBalls do | |||
ball[i]:reset(i) | |||
end | |||
end | |||
end | |||
if (ball[i]:collides(player2)) then | |||
sounds["score"]:play() | |||
if (nuckemodactive == 0) then | |||
areanuclear = 0 | |||
nuclearanimation = 3 | |||
end | |||
striken = 0 | |||
player1striken = 0 | |||
player2striken = 0 | |||
ballSpeed = ballSet | |||
if (synctype == 0) then | |||
paddle_SPEED = ballSet / 10 | |||
AI_SPEED = ballSet / 10 | |||
end | |||
if (synctype == 1) then | |||
paddle_SPEED = ballSpeed / 10 | |||
AI_SPEED = ballSpeed / 10 | |||
end | |||
AI_SPEED = difficultyl / 10 | |||
player1score = player1score + 1 | |||
if (player1score == ptw) then | |||
ball[i]:reset(i) | |||
sounds["win"]:play() | |||
gameState = "done" | |||
TEXT = "Player 1 Won!" | |||
else | |||
gameState = "2serve" | |||
serveBot() | |||
ball[i]:reset(i) | |||
end | |||
end | |||
end | |||
end | |||