Browse Source

Fixed slowdowns

tags/crossplatform
Madiwka4 3 years ago
parent
commit
00f85394f6
3 changed files with 9 additions and 9 deletions
  1. +6
    -6
      main.lua
  2. +2
    -2
      src/baseGame.lua
  3. +1
    -1
      src/constantvars.lua

+ 6
- 6
main.lua View File

@@ -2062,7 +2062,7 @@ function love.touchpressed( id, x, y, dx, dy, pressure )
table.insert(touches, newTouch(id, x*DIFFERENCE_X, y*DIFFERENCE_Y)) table.insert(touches, newTouch(id, x*DIFFERENCE_X, y*DIFFERENCE_Y))
local time = love.timer.getTime() local time = love.timer.getTime()
if x * DIFFERENCE_X < VIRTUAL_WIDTH/2 then if x * DIFFERENCE_X < VIRTUAL_WIDTH/2 then
if time <= lastclick + clickInterval and x*DIFFERENCE_X > 50 then
if time <= lastclick + clickInterval and x*DIFFERENCE_X > 100 then
doubleclick1 = true doubleclick1 = true
if gameState == "1serve" then if gameState == "1serve" then
lastSentKey = "q" lastSentKey = "q"
@@ -2074,7 +2074,7 @@ function love.touchpressed( id, x, y, dx, dy, pressure )
lastclick = time lastclick = time
end end
else else
if time <= lastclick + clickInterval and x*DIFFERENCE_X > VIRTUAL_WIDTH-50 then
if time <= lastclick + clickInterval and x*DIFFERENCE_X > VIRTUAL_WIDTH-100 then
doubleclick2 = true doubleclick2 = true
if gameState == "2serve" then if gameState == "2serve" then
lastSentKey = "p" lastSentKey = "p"
@@ -2143,16 +2143,16 @@ function table.empty (self)
end end
function sectortouched(sector) function sectortouched(sector)
for i, touch in ipairs(touches) do for i, touch in ipairs(touches) do
if sector == 1 and touch.x > VIRTUAL_WIDTH-60 and touch.y < VIRTUAL_HEIGHT/2 then
if sector == 1 and touch.x > VIRTUAL_WIDTH-100 and touch.y < VIRTUAL_HEIGHT/2 then
lastSentKey = p2control.up lastSentKey = p2control.up
return true return true
elseif sector == 2 and touch.x < 60 and touch.y < VIRTUAL_HEIGHT/2 then
elseif sector == 2 and touch.x < 100 and touch.y < VIRTUAL_HEIGHT/2 then
lastSentKey = p1control.up lastSentKey = p1control.up
return true return true
elseif sector == 3 and touch.x < 60 and touch.y > VIRTUAL_HEIGHT/2 then
elseif sector == 3 and touch.x < 100 and touch.y > VIRTUAL_HEIGHT/2 then
lastSentKey = p1control.down lastSentKey = p1control.down
return true return true
elseif sector == 4 and touch.x > VIRTUAL_WIDTH-60 and touch.y > VIRTUAL_HEIGHT/2 then
elseif sector == 4 and touch.x > VIRTUAL_WIDTH-100 and touch.y > VIRTUAL_HEIGHT/2 then
lastSentKey = p2control.down lastSentKey = p2control.down
return true return true
end end


+ 2
- 2
src/baseGame.lua View File

@@ -1326,7 +1326,7 @@ function clientsBaseGame(dt)
--love.window.setTitle('Trying to update the ball') --love.window.setTitle('Trying to update the ball')
if timeIsSlow then if timeIsSlow then
if ballSpeed > originalSpeed / 3 then if ballSpeed > originalSpeed / 3 then
paddle_SPEED = 30
paddle_SPEED = 300
ballSpeed = ballSpeed / (1 + (dt * 2)) ballSpeed = ballSpeed / (1 + (dt * 2))
end end
player1nukescore = player1nukescore - (dt * 50) player1nukescore = player1nukescore - (dt * 50)
@@ -1344,7 +1344,7 @@ function clientsBaseGame(dt)
end end
player2nukescore = player2nukescore - (dt * 50) player2nukescore = player2nukescore - (dt * 50)
if player2nukescore < 1 or ball[1].dx < 0 then if player2nukescore < 1 or ball[1].dx < 0 then
paddle_SPEED = 30
paddle_SPEED = 300
timeIsSlow2 = false timeIsSlow2 = false
player2reverbav = false player2reverbav = false
ballSpeed = originalSpeed ballSpeed = originalSpeed


+ 1
- 1
src/constantvars.lua View File

@@ -2,4 +2,4 @@ VIRTUAL_WIDTH = 1280
VIRTUAL_HEIGHT = 720 VIRTUAL_HEIGHT = 720
WINDOW_WIDTH = 1280 WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720 WINDOW_HEIGHT = 720
isAndroid = false
isAndroid = true

Loading…
Cancel
Save