Browse Source

Fixed music and other bugs

master
Madiwka3 3 years ago
parent
commit
8eb1c76cae
4 changed files with 30 additions and 11 deletions
  1. +13
    -2
      main.lua
  2. +4
    -4
      music.lua
  3. +12
    -4
      src/baseGame.lua
  4. +1
    -1
      src/constantvars.lua

+ 13
- 2
main.lua View File

@@ -6,7 +6,7 @@ require "src/dependencies"
--print(content) --print(content)
--love.filesystem.write("libdiscord-rpc.so", content) --love.filesystem.write("libdiscord-rpc.so", content)
if not isAndroid then if not isAndroid then
local discordRPC = require("src/discordRPC")
discordRPC = require("src/discordRPC")
end end


local appId = require("applicationId") local appId = require("applicationId")
@@ -34,6 +34,7 @@ showTouchControls = false




--0.9 VARIABLES --0.9 VARIABLES
freePlay = false
startTime = os.time(os.date("*t")) startTime = os.time(os.date("*t"))
globalMessage = "none" globalMessage = "none"
globalAnimation = "none" globalAnimation = "none"
@@ -295,6 +296,7 @@ function love.load()
else else
gameState = "1serve" gameState = "1serve"
end end
freePlay = true
potentialnuke1 = 0 potentialnuke1 = 0
potentialnuke2 = 0 potentialnuke2 = 0
striken = 0 striken = 0
@@ -1027,7 +1029,7 @@ function startShake(duration, magnitude)
t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5 t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5
end end
function displayFPS() function displayFPS()
love.window.setTitle(love.timer.getFPS())
love.window.setTitle("Nuclear Pong")
--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
@@ -2073,6 +2075,7 @@ function resolutionChanger()
end end
function resettinggenius() function resettinggenius()
maxBalls = 1 maxBalls = 1
freePlay = false
for i = 1, maxBalls do for i = 1, maxBalls do
ball[i]:reset(i) ball[i]:reset(i)
end end
@@ -2555,3 +2558,11 @@ function resetButtonX(arr)
end end
end end


function discordRPC.joinRequest(userId, username, discriminator, avatar)
print(string.format("Discord: join request (%s, %s, %s, %s)", userId, username, discriminator, avatar))
discordRPC.respond(userId, "yes")
end

function discordRPC.joinGame(joinSecret)
print(string.format("Discord: join (%s)", joinSecret))
end

+ 4
- 4
music.lua View File

@@ -10,7 +10,7 @@ function musicController(orders, toggling)
sounds['gayTheme']:setVolume(0) sounds['gayTheme']:setVolume(0)
sounds['gayTheme2']:setVolume(0) sounds['gayTheme2']:setVolume(0)
elseif ((gameState == 'play' or gameState == '1serve' or gameState == '2serve') and player1score <= ptw*0.5 and player2score <= ptw*0.5 and areanuclear == 0) then
elseif ((gameState == 'play' or gameState == '1serve' or gameState == '2serve') and (player1score <= ptw*0.5 and player2score <= ptw*0.5 and areanuclear == 0) and not freePlay) then
sounds['updateMusic']:stop() sounds['updateMusic']:stop()
sounds['gayTheme2']:stop() sounds['gayTheme2']:stop()
sounds['gayTheme3']:stop() sounds['gayTheme3']:stop()
@@ -19,7 +19,7 @@ function musicController(orders, toggling)
sounds['gayTheme']:setLooping(true) sounds['gayTheme']:setLooping(true)
sounds['gayTheme']:setVolume(0.5) sounds['gayTheme']:setVolume(0.5)
sounds['gayTheme']:play() sounds['gayTheme']:play()
elseif gameState == 'play' and areanuclear == 0 and ((AGAINST_AI == 1 and player1score >= ptw*0.8 and player2score < ptw*0.8) or (globalState == "nettest" and player1score > ptw*0.8 and player2score <= ptw*0.8) or (globalState == "clienttest" and player2score > ptw*0.8 and player1score <= ptw*0.8)) then
elseif gameState == 'play' and areanuclear == 0 and ((AGAINST_AI == 1 and player1score >= ptw*0.8 and player2score < ptw*0.8) or (globalState == "nettest" and player1score > ptw*0.8 and player2score <= ptw*0.8) or (globalState == "clienttest" and player2score > ptw*0.8 and player1score <= ptw*0.8) and not freePlay) then
--print(ptw*0.8) --print(ptw*0.8)
sounds['gayTheme']:stop() sounds['gayTheme']:stop()
sounds['gayTheme2']:stop() sounds['gayTheme2']:stop()
@@ -29,7 +29,7 @@ function musicController(orders, toggling)
sounds['gayTheme4']:setLooping(true) sounds['gayTheme4']:setLooping(true)
sounds['gayTheme4']:setVolume(0.5) sounds['gayTheme4']:setVolume(0.5)
sounds['gayTheme4']:play() sounds['gayTheme4']:play()
elseif gameState == 'play' and player1score >= ptw*0.8 or player2score > ptw*0.8 and areanuclear == 0 then
elseif gameState == 'play' and (player1score >= ptw*0.8 or player2score > ptw*0.8) and areanuclear == 0 and not freePlay then
--print(ptw*0.8) --print(ptw*0.8)
sounds['gayTheme']:stop() sounds['gayTheme']:stop()
sounds['gayTheme4']:stop() sounds['gayTheme4']:stop()
@@ -39,7 +39,7 @@ function musicController(orders, toggling)
sounds['gayTheme2']:setLooping(true) sounds['gayTheme2']:setLooping(true)
sounds['gayTheme2']:setVolume(0.5) sounds['gayTheme2']:setVolume(0.5)
sounds['gayTheme2']:play() sounds['gayTheme2']:play()
elseif gameState == 'play' and player1score > ptw*0.5 or player2score > ptw*0.5 and areanuclear == 0 then
elseif gameState == 'play' and (player1score > ptw*0.5 or player2score > ptw*0.5 or freePlay) and areanuclear == 0 then
--print(ptw-4) --print(ptw-4)
sounds['gayTheme']:stop() sounds['gayTheme']:stop()
sounds['gayTheme2']:stop() sounds['gayTheme2']:stop()


+ 12
- 4
src/baseGame.lua View File

@@ -402,7 +402,7 @@ function goalManager()
for i = 1, maxBalls do for i = 1, maxBalls do
ball[i]:reset(i, 2) ball[i]:reset(i, 2)
end end
if (player2score+1 == ptw+maxBalls-1 and gameMode ~= "practice") then
if (player2score+1 == ptw+maxBalls-1 and gameMode ~= "practice" and not freePlay ) then
for i = 1, maxBalls do for i = 1, maxBalls do
ball[i]:reset(i) ball[i]:reset(i)
end end
@@ -417,7 +417,7 @@ function goalManager()
end end
end end
end end
sounds["score"]:play()
player2score = player2score + 1 player2score = player2score + 1
end end
if (rules("p2miss", i)) then if (rules("p2miss", i)) then
@@ -444,7 +444,7 @@ function goalManager()
AI_SPEED = difficultyl AI_SPEED = difficultyl
if (player1score+1 == ptw+maxBalls-1) then
if (player1score+1 == ptw+maxBalls-1 and not freePlay) then
ball[i]:reset(i) ball[i]:reset(i)
sounds["win"]:play() sounds["win"]:play()
@@ -900,7 +900,15 @@ function baseDraw()
end end


if globalState == 'base' or globalState == 'reverse' or globalState == 'nettest' or globalState == 'clienttest' then if globalState == 'base' or globalState == 'reverse' or globalState == 'nettest' or globalState == 'clienttest' then

if globalState == "nettest" then
presence = {
state = "Enjoying Pong",
details = "Main Menu",
largeImageKey = "pongnew",
largeImageText = "Nuclear Pong",
joinSecret = IP,
}
end
love.graphics.setFont(smallfont) love.graphics.setFont(smallfont)
if gameState == 'nuclearExplosion' then if gameState == 'nuclearExplosion' then
nuclearDraw() nuclearDraw()


+ 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 = true
isAndroid = false

Loading…
Cancel
Save