Browse Source

0.7.8 Look&Feel update

tags/gentletouch
Madiwka3 4 years ago
parent
commit
9bfd4a8c88
4 changed files with 67 additions and 30 deletions
  1. +43
    -14
      main.lua
  2. +10
    -10
      music.lua
  3. +5
    -5
      src/AI.lua
  4. +9
    -1
      src/baseGame.lua

+ 43
- 14
main.lua View File

@@ -399,7 +399,7 @@ function love.load()
-- ) -- )
--) --)
table.insert( table.insert(
settings,
buttons,
newButton( newButton(
"Toggle Fullscreen", "Toggle Fullscreen",
function() function()
@@ -409,6 +409,34 @@ function love.load()
end 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( table.insert(
settings, settings,
newButton( newButton(
@@ -797,7 +825,7 @@ function startShake(duration, magnitude)
end end
function displayFPS() function displayFPS()
--love.window.setTitle(love.timer.getFPS()) --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 if love.keyboard.isDown("space") then
player1nukescore = 200 player1nukescore = 200
player1score = player1score + 0.2 player1score = player1score + 0.2
@@ -816,13 +844,14 @@ function love.update(dt)
--print("IMPORTANT!!!!!" .. globalState .. gameState) --print("IMPORTANT!!!!!" .. globalState .. gameState)
staticanimatorcounter(dt) staticanimatorcounter(dt)
player1.goal = -1
player2.goal = -1
player1.goal = -1
player2.goal = -1
if gameState == "chooseIP" then if gameState == "chooseIP" then
checkCurrentServer(dt) checkCurrentServer(dt)
end end
if debug then if debug then
displayFPS() displayFPS()
print(player2.y .. " " .. player2.goal .. " " .. player2.dy .. " " .. AI_SPEED .. " " .. paddle_SPEED)
end end
if globalState == "base" then if globalState == "base" then
basegame(dt) basegame(dt)
@@ -1006,7 +1035,7 @@ function nettest(dt)
until not data until not data
if not datawaspassed then if not datawaspassed then
datawaspassedtimer = datawaspassedtimer + 1 datawaspassedtimer = datawaspassedtimer + 1
if datawaspassedtimer > 10 then
if datawaspassedtimer > 15 then
confirmation = "D" confirmation = "D"
datawaspassedtimer = 0 datawaspassedtimer = 0
end end
@@ -1065,10 +1094,10 @@ function clienttest(dt)
confirmation = "N" confirmation = "N"
local p = split(data, '|') local p = split(data, '|')
if p[17] then if p[17] then
if p[18] ~= "HOST" then
if p[17] ~= "HOST" then
confirmation = "U" confirmation = "U"
end end
if tonumber(p[17]) > 90 then
if tonumber(p[18]) > 90 then
confirmation = "L" confirmation = "L"
end end
for i = 1, maxBalls do for i = 1, maxBalls do
@@ -1099,7 +1128,7 @@ function clienttest(dt)
until not data until not data
if not datawaspassed then if not datawaspassed then
datawaspassedtimer = datawaspassedtimer + 1 datawaspassedtimer = datawaspassedtimer + 1
if datawaspassedtimer > 10 then
if datawaspassedtimer > 15 then
confirmation = "D" confirmation = "D"
datawaspassedtimer = 0 datawaspassedtimer = 0
end end
@@ -1870,9 +1899,9 @@ function checkCurrentServer(dt)
--print("got answer!") --print("got answer!")
local p = split(data, '|') local p = split(data, '|')
status = p[1] status = p[1]
--print("answer is " .. status)
print("answer is " .. status)
else else
--print("no response!")
print("no response!")
end end
ts = 0 ts = 0
end end
@@ -2200,16 +2229,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-100 and touch.y < VIRTUAL_HEIGHT/2 then
if touch.x > VIRTUAL_WIDTH-100 and touch.y < player2.y then
lastSentKey = p2control.up lastSentKey = p2control.up
return true 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 lastSentKey = p1control.up
return true 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 lastSentKey = p1control.down
return true 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 lastSentKey = p2control.down
return true return true
end end


+ 10
- 10
music.lua View File

@@ -1,5 +1,5 @@
function musicController(orders, toggling) function musicController(orders, toggling)
if (orders == 'norm') then
if (orders == 'norm' and not mute) then
if (globalState == 'menu') then if (globalState == 'menu') then
sounds['gayTheme']:stop() sounds['gayTheme']:stop()
sounds['gayTheme2']:stop() sounds['gayTheme2']:stop()
@@ -37,15 +37,15 @@ function musicController(orders, toggling)
sounds['gayTheme3']:play() sounds['gayTheme3']:play()
end 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 end
end end

+ 5
- 5
src/AI.lua View File

@@ -112,9 +112,9 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial)
local time = (VIRTUAL_HEIGHT-40-ey) / (ballSpeed * edy) local time = (VIRTUAL_HEIGHT-40-ey) / (ballSpeed * edy)
local distance = math.abs(ballSpeed * edx) * time 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 if distance > math.abs(px - ex) then
print("QQ")
--print("QQ")
local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx) local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx)
local bonus = (ballSpeed * edy) * anstime local bonus = (ballSpeed * edy) * anstime
--print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex)) --print("results: " .. bonus .. " " .. edx .. " " .. anstime .. " " .. (px-ex))
@@ -127,7 +127,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial)
-- return -1 -- return -1
--end --end
else else
print("SS")
--print("SS")
local emulatedx = ex + distance * edx local emulatedx = ex + distance * edx
local emulatedy = VIRTUAL_HEIGHT-40 local emulatedy = VIRTUAL_HEIGHT-40
print("EMULATED: " .. emulatedx .. " " .. emulatedy) print("EMULATED: " .. emulatedx .. " " .. emulatedy)
@@ -142,7 +142,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial)
--print ("inverse" .. ex .." " .. ey .. " " .. edx .. " " .. edy) --print ("inverse" .. ex .." " .. ey .. " " .. edx .. " " .. edy)
local time = (ey) / math.abs((ballSpeed * edy)) local time = (ey) / math.abs((ballSpeed * edy))
local distance = math.abs(ballSpeed * edx) * time 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 ") --print("Why th efuck ")
@@ -150,7 +150,7 @@ function recursiveCalculations(px, ex, ey, edx, edy, ifspecial)
if distance > math.abs(px - ex) then if distance > math.abs(px - ex) then
local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx) local anstime = math.abs(px - ex) / math.abs(ballSpeed * edx)
local bonus = (ballSpeed * edy) * anstime 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 -- if (ifspecial == 0) then
local answer = ey + bonus local answer = ey + bonus
--love.window.setTitle(tostring(answer) .. "Basiccalc") --love.window.setTitle(tostring(answer) .. "Basiccalc")


+ 9
- 1
src/baseGame.lua View File

@@ -356,7 +356,7 @@ end
function debugCheck(dt) function debugCheck(dt)
if (gameState == "menu") then if (gameState == "menu") then
updateTEXT = "0.7.7 Chalkboard Update"
updateTEXT = "0.7.8 Chalkboard Update"
end end
dangerChecker() dangerChecker()
elapsed = elapsed + dt elapsed = elapsed + dt
@@ -714,6 +714,7 @@ function menuDraw()
) )
) )
end end
if not isAndroid then
table.insert( table.insert(
IPselect, IPselect,
newButton( newButton(
@@ -726,6 +727,7 @@ function menuDraw()
end end
) )
) )
end
table.insert( table.insert(
IPselect, IPselect,
newButton( newButton(
@@ -744,6 +746,7 @@ function menuDraw()
newButton( newButton(
"Connect as Host", "Connect as Host",
function() function()
resettinggenius()
globalState = "nettest" globalState = "nettest"
AGAINST_AI = 0 AGAINST_AI = 0
gameState = "1serve" gameState = "1serve"
@@ -758,6 +761,7 @@ function menuDraw()
newButton( newButton(
"Connect as Guest", "Connect as Guest",
function() function()
resettinggenius()
globalState = "clienttest" globalState = "clienttest"
AGAINST_AI = 0 AGAINST_AI = 0
gameState = "1serve" gameState = "1serve"
@@ -1431,6 +1435,8 @@ function menuDemo(dt)
player2.y = ball[1].y-player2.height player2.y = ball[1].y-player2.height
end end
if ball[1].x >= player2.x-7 then if ball[1].x >= player2.x-7 then
sounds["beep"]:setPitch(ballSpeed / 250)
sounds["beep"]:play()
select = math.random(1, 2) select = math.random(1, 2)
if ball[1].dy < 0 then if ball[1].dy < 0 then
select = math.random(1, 5) select = math.random(1, 5)
@@ -1464,6 +1470,8 @@ function menuDemo(dt)
ball[1].dy = -ball[1].dy ball[1].dy = -ball[1].dy
end end
if ball[1].x <= player1.x+7 then if ball[1].x <= player1.x+7 then
sounds["beep"]:setPitch(ballSpeed / 250)
sounds["beep"]:play()
select = math.random(1, 2) select = math.random(1, 2)
if ball[1].dy < 0 then if ball[1].dy < 0 then
select = math.random(1, 5) select = math.random(1, 5)


Loading…
Cancel
Save