| @@ -399,7 +399,7 @@ function love.load() | |||
| -- ) | |||
| --) | |||
| table.insert( | |||
| settings, | |||
| buttons, | |||
| newButton( | |||
| "Toggle Fullscreen", | |||
| function() | |||
| @@ -409,6 +409,34 @@ function love.load() | |||
| end | |||
| ) | |||
| ) | |||
| if isAndroid then | |||
| table.insert( | |||
| settings, | |||
| newButton( | |||
| "Toggle Music", | |||
| function() | |||
| if mute then | |||
| musicController("mute", 0) | |||
| else | |||
| musicController("mute", 1) | |||
| end | |||
| end | |||
| ) | |||
| ) | |||
| end | |||
| table.insert( | |||
| settings, | |||
| newButton( | |||
| "Toggle Music", | |||
| function() | |||
| if mute then | |||
| musicController("mute", 0) | |||
| else | |||
| musicController("mute", 1) | |||
| end | |||
| end | |||
| ) | |||
| ) | |||
| table.insert( | |||
| settings, | |||
| newButton( | |||
| @@ -797,7 +825,7 @@ function startShake(duration, magnitude) | |||
| end | |||
| function displayFPS() | |||
| --love.window.setTitle(love.timer.getFPS()) | |||
| love.window.setTitle(globalState .. " " .. gameState .. " " .. paddle_SPEED .. " " .. p1bonus .. " " .. player1.dy) | |||
| --love.window.setTitle(globalState .. " " .. gameState .. " " .. paddle_SPEED .. " " .. p1bonus .. " " .. player1.dy) | |||
| if love.keyboard.isDown("space") then | |||
| player1nukescore = 200 | |||
| player1score = player1score + 0.2 | |||
| @@ -816,13 +844,14 @@ function love.update(dt) | |||
| --print("IMPORTANT!!!!!" .. globalState .. gameState) | |||
| staticanimatorcounter(dt) | |||
| player1.goal = -1 | |||
| player2.goal = -1 | |||
| player1.goal = -1 | |||
| player2.goal = -1 | |||
| if gameState == "chooseIP" then | |||
| checkCurrentServer(dt) | |||
| end | |||
| if debug then | |||
| displayFPS() | |||
| print(player2.y .. " " .. player2.goal .. " " .. player2.dy .. " " .. AI_SPEED .. " " .. paddle_SPEED) | |||
| end | |||
| if globalState == "base" then | |||
| basegame(dt) | |||
| @@ -1006,7 +1035,7 @@ function nettest(dt) | |||
| until not data | |||
| if not datawaspassed then | |||
| datawaspassedtimer = datawaspassedtimer + 1 | |||
| if datawaspassedtimer > 10 then | |||
| if datawaspassedtimer > 15 then | |||
| confirmation = "D" | |||
| datawaspassedtimer = 0 | |||
| end | |||
| @@ -1065,10 +1094,10 @@ function clienttest(dt) | |||
| confirmation = "N" | |||
| local p = split(data, '|') | |||
| if p[17] then | |||
| if p[18] ~= "HOST" then | |||
| if p[17] ~= "HOST" then | |||
| confirmation = "U" | |||
| end | |||
| if tonumber(p[17]) > 90 then | |||
| if tonumber(p[18]) > 90 then | |||
| confirmation = "L" | |||
| end | |||
| for i = 1, maxBalls do | |||
| @@ -1099,7 +1128,7 @@ function clienttest(dt) | |||
| until not data | |||
| if not datawaspassed then | |||
| datawaspassedtimer = datawaspassedtimer + 1 | |||
| if datawaspassedtimer > 10 then | |||
| if datawaspassedtimer > 15 then | |||
| confirmation = "D" | |||
| datawaspassedtimer = 0 | |||
| end | |||
| @@ -1870,9 +1899,9 @@ function checkCurrentServer(dt) | |||
| --print("got answer!") | |||
| local p = split(data, '|') | |||
| status = p[1] | |||
| --print("answer is " .. status) | |||
| print("answer is " .. status) | |||
| else | |||
| --print("no response!") | |||
| print("no response!") | |||
| end | |||
| ts = 0 | |||
| end | |||
| @@ -2200,16 +2229,16 @@ function table.empty (self) | |||
| end | |||
| function sectortouched(sector) | |||
| for i, touch in ipairs(touches) do | |||
| if sector == 1 and touch.x > VIRTUAL_WIDTH-100 and touch.y < VIRTUAL_HEIGHT/2 then | |||
| if touch.x > VIRTUAL_WIDTH-100 and touch.y < player2.y then | |||
| lastSentKey = p2control.up | |||
| return true | |||
| elseif sector == 2 and touch.x < 100 and touch.y < VIRTUAL_HEIGHT/2 then | |||
| elseif sector == 2 and touch.x < 100 and touch.y < player1.y then | |||
| lastSentKey = p1control.up | |||
| return true | |||
| elseif sector == 3 and touch.x < 100 and touch.y > VIRTUAL_HEIGHT/2 then | |||
| elseif sector == 3 and touch.x < 100 and touch.y > player1.y+player1.height*0.9 then | |||
| lastSentKey = p1control.down | |||
| return true | |||
| elseif sector == 4 and touch.x > VIRTUAL_WIDTH-100 and touch.y > VIRTUAL_HEIGHT/2 then | |||
| elseif sector == 4 and touch.x > VIRTUAL_WIDTH-100 and touch.y > player2.y+player1.height*0.9 then | |||
| lastSentKey = p2control.down | |||
| return true | |||
| end | |||
| @@ -1,5 +1,5 @@ | |||
| function musicController(orders, toggling) | |||
| if (orders == 'norm') then | |||
| if (orders == 'norm' and not mute) then | |||
| if (globalState == 'menu') then | |||
| sounds['gayTheme']:stop() | |||
| sounds['gayTheme2']:stop() | |||
| @@ -37,15 +37,15 @@ function musicController(orders, toggling) | |||
| sounds['gayTheme3']:play() | |||
| end | |||
| elseif orders ~= nil then | |||
| sounds[orders]:setPitch(1) | |||
| sounds[orders]:setLooping(true) | |||
| sounds[orders]:setVolume(0.9) | |||
| sounds[orders]:play() | |||
| if (toggling == 1) then | |||
| sounds[orders]:setVolume(0.9) | |||
| else | |||
| sounds[orders]:stop() | |||
| elseif orders == "mute" then | |||
| if toggling == 1 then | |||
| sounds['gayTheme']:stop() | |||
| sounds['gayTheme3']:stop() | |||
| sounds['gayTheme2']:stop() | |||
| sounds['updateMusic']:stop() | |||
| mute = true | |||
| else | |||
| mute = false | |||
| end | |||
| end | |||
| end | |||
| @@ -112,9 +112,9 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
| local time = (VIRTUAL_HEIGHT-40-ey) / (ballSpeed * edy) | |||
| local distance = math.abs(ballSpeed * edx) * time | |||
| print("DOWNWARD" .. distance .. " " .. edx .. " " .. time .. " " .. math.abs(px-ex)) | |||
| --print("DOWNWARD" .. distance .. " " .. edx .. " " .. time .. " " .. math.abs(px-ex)) | |||
| if distance > math.abs(px - ex) then | |||
| print("QQ") | |||
| --print("QQ") | |||
| local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx) | |||
| local bonus = (ballSpeed * edy) * anstime | |||
| --print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) | |||
| @@ -127,7 +127,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
| -- return -1 | |||
| --end | |||
| else | |||
| print("SS") | |||
| --print("SS") | |||
| local emulatedx = ex + distance * edx | |||
| local emulatedy = VIRTUAL_HEIGHT-40 | |||
| print("EMULATED: " .. emulatedx .. " " .. emulatedy) | |||
| @@ -142,7 +142,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
| --print ("inverse" .. ex .." " .. ey .. " " .. edx .. " " .. edy) | |||
| local time = (ey) / math.abs((ballSpeed * edy)) | |||
| local distance = math.abs(ballSpeed * edx) * time | |||
| print("UPWARD" .. distance .. " " .. edx .. " " .. time .. " " .. math.abs(px-ex)) | |||
| --print("UPWARD" .. distance .. " " .. edx .. " " .. time .. " " .. math.abs(px-ex)) | |||
| --print("Why th efuck ") | |||
| @@ -150,7 +150,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial) | |||
| if distance > math.abs(px - ex) then | |||
| local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx) | |||
| local bonus = (ballSpeed * edy) * anstime | |||
| print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. math.abs(px-ex)) | |||
| --print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. math.abs(px-ex)) | |||
| -- if (ifspecial == 0) then | |||
| local answer = ey + bonus | |||
| --love.window.setTitle(tostring(answer) .. "Basiccalc") | |||
| @@ -356,7 +356,7 @@ end | |||
| function debugCheck(dt) | |||
| if (gameState == "menu") then | |||
| updateTEXT = "0.7.7 Chalkboard Update" | |||
| updateTEXT = "0.7.8 Chalkboard Update" | |||
| end | |||
| dangerChecker() | |||
| elapsed = elapsed + dt | |||
| @@ -714,6 +714,7 @@ function menuDraw() | |||
| ) | |||
| ) | |||
| end | |||
| if not isAndroid then | |||
| table.insert( | |||
| IPselect, | |||
| newButton( | |||
| @@ -726,6 +727,7 @@ function menuDraw() | |||
| end | |||
| ) | |||
| ) | |||
| end | |||
| table.insert( | |||
| IPselect, | |||
| newButton( | |||
| @@ -744,6 +746,7 @@ function menuDraw() | |||
| newButton( | |||
| "Connect as Host", | |||
| function() | |||
| resettinggenius() | |||
| globalState = "nettest" | |||
| AGAINST_AI = 0 | |||
| gameState = "1serve" | |||
| @@ -758,6 +761,7 @@ function menuDraw() | |||
| newButton( | |||
| "Connect as Guest", | |||
| function() | |||
| resettinggenius() | |||
| globalState = "clienttest" | |||
| AGAINST_AI = 0 | |||
| gameState = "1serve" | |||
| @@ -1431,6 +1435,8 @@ function menuDemo(dt) | |||
| player2.y = ball[1].y-player2.height | |||
| end | |||
| if ball[1].x >= player2.x-7 then | |||
| sounds["beep"]:setPitch(ballSpeed / 250) | |||
| sounds["beep"]:play() | |||
| select = math.random(1, 2) | |||
| if ball[1].dy < 0 then | |||
| select = math.random(1, 5) | |||
| @@ -1464,6 +1470,8 @@ function menuDemo(dt) | |||
| ball[1].dy = -ball[1].dy | |||
| end | |||
| if ball[1].x <= player1.x+7 then | |||
| sounds["beep"]:setPitch(ballSpeed / 250) | |||
| sounds["beep"]:play() | |||
| select = math.random(1, 2) | |||
| if ball[1].dy < 0 then | |||
| select = math.random(1, 5) | |||