|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686 |
- --CALLING OTHER LUA FILES
- require 'src/dependencies'
- io.stdout:setvbuf('no')
- --CANCELLED ATTEMPETED SHADING (NOT WORKING)
- local shader_code = [[
- vec4 effect(vec4 color, Image image, vec2 uvs, vec2 screen_coords) {
- vec4 pixel = Texel(image,uvs);
- return pixel * color;
- }
- ]]
-
- debug = true
-
- --GLOBAL VARIABLES
- globalState = 'menu'
- timeIsSlow = false
- timeIsSlow2 = false
- originalSpeed = 200
- explosionRange = 0
- blockinput = false
- wall1width = 30
- nuclearanimation = 3
- easternum = 0
- ball_DIR = 0
- RED = 255
- hitNum = {}
- hitNum[1] = 0
- hitNum[2] = 0
- hitNum[3] = 0
- hitNum[4] = 0
- p1bonus = 0
- p2bonus = 0
- hitNum[5] = 0
- hitNum[6] = 0
- GREEN = 255
- BLUE = 255
- updateTEXT = 'Chalkboard Update'
- maxBalls = 1
- playerCount = 1
- player1reverbav = 0
- playertext = '1v1'
- player2reverbav = 0
- elapsed = 0
- rotation = 0
- TEXT = 'Nuclear Pong'
- currentKey = " "
- ptw = 10
-
-
-
- --CHECKING IF CONTROLS ARE TAKEN
- danger = 'none'
- danger2 = 'none'
-
-
- nuckemodactive = 0
- maxspeed = 700
- DIFFERENCE_X = 1
- DIFFERENCE_Y = 1
- paddle_SPEED = 20
- textamount = 15
- AI_STRIKEMOD = 1000
- resolutionWin = 0
- AGAINST_AI = 0
- RESOLUTION_SET = 0
- AI_NUKEMOD = 1000
- animstart = true
- AI_SPEED = 30
- craz = 0
- AI_LEVEL = 500
- isFullscreen = 0
- prtext = 'Easy'
- MAP_TYPE = 2
- difficultyl = 300
- req = 'pp'
- ballSet = 200
- p1control = {up = 'a', down = 'z', super = 's', counter = 'x'}
- p2control = {up = ';', down = '.', super = 'l', counter = ','}
- synctext = "Independent"
- synctype = 0
- function newButton(text, fn)
- return {
- text = text,
- fn = fn,
- now = false,
- last = false
- }
- end
- function love.keyboard.mouseWasReleased()
- return love.keyboard.mouseisReleased
- end
- function autoSave(dt)
- autoTimer = autoTimer + dt
- end
-
- function balancer()
- if (player2score == 9 or player1score == 9) then
- shakeDuration = 10
- if debug then
- print("Shaking set to match almost over")
- end
- end
- if (player1score < player2score) then
- p1bonus = (player2score - player1score) * 5
- else
- p1bonus = 0
- end
- if (player2score < player1score) then
- p2bonus = (player1score - player2score) * 5
- else
- p2bonus = 0
- end
- end
-
- function newWall(wallx, wally, wallwidth, wallheight)
- return {
- wallx = wallx,
- wally = wally,
- walwidth = wallwidth,
- wallheight = wallheight
- }
- end
- speedParameters = {}
- buttons = {}
- difbuttons = {}
- settings = {}
- walls = {}
- editorpicks = {}
- controlSettings = {}
- modeSelectorButtons= {}
- pracdiff = {}
- playerCountButtons = {}
- function controlChanger()
- if (gameState == 'assign') then
- love.graphics.clear(50/255,50/255,50/255,255)
- love.graphics.printf('SELECT BUTTON',0,VIRTUAL_HEIGHT / 2,VIRTUAL_WIDTH,'center')
- end
- end
- function love.load()
- simpleScale.setWindow(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT)
- configfile = io.open('config.lua', "r")
- configsave = io.open('config.lua', "w")
- shader = love.graphics.newShader(shader_code)
- time_1 = 0
- print("Debug active")
- --load
-
- testwalls = love.filesystem.load('save.lua')()
- if testwalls ~= nil then
- walls = love.filesystem.load('save.lua')()
- end
-
-
-
- light = 0
- image = love.graphics.newImage("Madi.png")
- table.insert(editorpicks, newButton("C", function() for k in pairs (walls) do walls[k] = nil end end))
- table.insert(editorpicks, newButton("S", function() love.filesystem.write('save.lua', serialize(walls)) end))
- table.insert(editorpicks, newButton("L", function() walls = love.filesystem.load('save.lua')() end))
- table.insert(buttons, newButton("Singleplayer", function() gameState = 'gameMode' end))
- table.insert(buttons, newButton("Multiplayer", function() gameState = 'multiMode' end))
- table.insert(buttons, newButton("Settings", function() AGAINST_AI = 0 gameState = 'windowsettings' end))
- table.insert(buttons, newButton("Exit", function() love.event.quit(0) end))
- table.insert(difbuttons, newButton("Easy", function() hardmanager('easy') end))
- table.insert(difbuttons, newButton("Normal", function() hardmanager('normal') end))
- table.insert(difbuttons, newButton("Hard", function() hardmanager('hard') end))
- table.insert(settings, newButton("Change Map", function() MAP_TYPE = MAP_TYPE + 1 end))
- table.insert(settings, newButton("Toggle Fullscreen", function() myscreen:toggle(VIRTUAL_HEIGHT, VIRTUAL_WIDTH) DIFFERENCE_X = myscreen.c DIFFERENCE_Y = myscreen.d end))
- table.insert(settings, newButton("Editor", function() gameState = 'editor' end))
- table.insert(settings, newButton("Speed Settings", function() gameState = 'speedSettings' end))
- table.insert(settings, newButton("Control Settings", function() gameState = 'controlSettings' end))
- table.insert(settings, newButton("Back to Menu", function() gameState = 'menu' end))
- table.insert(speedParameters, newButton("Back to Menu", function() gameState = 'windowsettings' end))
- --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end))
- table.insert(playerCountButtons, newButton("Ball Speed: ", function() speedSetter('ball') end))
- --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end))
- table.insert(playerCountButtons, newButton("snc", function() speedSetter('snc') end))
- table.insert(speedParameters, newButton("NUCLEAR MODE", function() speedSetter('nuclearmod') end))
- table.insert(controlSettings, newButton("1up", function() gameState = 'assign' req = 'p1up' end))
- table.insert(controlSettings, newButton("1down", function() gameState = 'assign' req = 'p1down' end))
- table.insert(controlSettings, newButton("1special",function() gameState = 'assign' req = 'p1super' end))
- table.insert(controlSettings, newButton("1ct", function() gameState = 'assign' req = 'p1ct' end))
- table.insert(controlSettings, newButton("2up", function() gameState = 'assign' req = 'p2up' end))
- table.insert(controlSettings, newButton("2down", function() gameState = 'assign' req = 'p2down' end))
- table.insert(controlSettings, newButton("2special", function() gameState = 'assign' req = 'p2super' end))
- table.insert(controlSettings, newButton("2ct", function() gameState = 'assign' req = 'p2ct' end))
- table.insert(controlSettings, newButton("Default", function() p1control = {up = 'a', down = 'z', super = 's', counter = 'x'} p2control = {up = ';', down = '.', super = 'l', counter = ','} end))
- table.insert(controlSettings, newButton("Return", function() gameState = 'windowsettings' end))
- table.insert(modeSelectorButtons, newButton("Nuclear Pong", function() gameState = 'difficulty' end))
- table.insert(modeSelectorButtons, newButton("Nuclear Practice", function() gameState = 'prdiff' end))
- table.insert(modeSelectorButtons, newButton("Main Menu", function() gameState = 'menu' end))
- table.insert(pracdiff, newButton("Silverblade", function() speedSetter('practice') end))
- table.insert(pracdiff, newButton("Return", function() speedSetter('reset') gameState = 'gameMode' end))
- table.insert(pracdiff, newButton("Go!", function() gameMode = 'practice' hardmanager('practice') end))
- --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end))
- table.insert(playerCountButtons, newButton("ballCount", function() speedSetter('ballz') end))
- table.insert(playerCountButtons, newButton("Return", function() speedSetter('reset') gameState = 'menu' end))
- table.insert(playerCountButtons, newButton("ptw", function() speedSetter('ptw') end))
- table.insert(playerCountButtons, newButton("Play", function() AGAINST_AI = 0 gameState = '1serve' end))
-
-
-
- --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter() end))
-
-
- love.window.setTitle('NUCLEAR PONG')
- textphrases = {
- "Amazing", "Superb", "Absolutely beautiful!", "Awesome", "Look at That!", "Great", "Nice", "Boom!", "Dangerous!", "Astonishing!", "u/ebernerd saved me", "Absolutely Wonderful!", "Exsquisite", "Delicate", "Pow!", "Great Hit", "all hail nazarbayev"
- }
- sounds = {
- ['updateMusic'] = love.audio.newSource("audio/theme1.mp3", "static"),
- ['gayTheme'] = love.audio.newSource("audio/theme2.mp3", "static"),
- ['gayTheme2'] = love.audio.newSource("audio/theme3.mp3", "static"),
- ['gayTheme3'] = love.audio.newSource("audio/theme4.mp3", "static"),
- ['beep'] = love.audio.newSource("audio/hit1.mp3", "static"),
- ['wallhit'] = love.audio.newSource("audio/hit2.wav", "static"),
- ['win'] = love.audio.newSource("win.wav", "static"),
- ['score'] = love.audio.newSource("audio/score.wav", "static"),
- ['nuke'] = love.audio.newSource("audio/bomb.wav", "static"),
- ['striking'] = love.audio.newSource("audio/superhit.wav", "static"),
- ['nuclearhit'] = love.audio.newSource("audio/hit1.mp3", "static"),
- ['time'] = love.audio.newSource("audio/time.wav", "static")
- }
- love.graphics.setDefaultFilter('nearest', 'nearest')
- --comic sans lmao
- math.randomseed(os.time())
- smallfont = love.graphics.newFont('font.ttf', 25)
- scorefont = love.graphics.newFont('font.ttf', 60)
- love.graphics.setFont(smallfont)
-
- --push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
- -- fullscreen = isFullscreen,
- -- resizable = true,
- -- vsync = true,
- --})
- player1score = 0
- player2score = 0
- areanuclear = 0
- player1nukescore = 0
- player2nukescore = 0
- striken = 0
- soundtype = 1
- soundturn = 1
- potentialstrike1 = 0
- potentialstrike2 = 0
- potentialnuke1 = 0
- potentialnuke2 = 0
- player1striken = 0
- player2striken = 0
- randomtext = 0
- selecting = 0
- number = 0
- elec = 1
- INDIC = {
- '', '', '', ''
- }
- --playe1nuke
- player1 = paddle(0,30,10,100, 1)
- player2 = paddle(VIRTUAL_WIDTH * 0.99, VIRTUAL_HEIGHT * 0.88, 10, 100, 2)
- player3 = paddle(5000, 5000, 10, 100)
- player4 = paddle(5000, 5000, 10, 100)
- ball = {}
- ball[1] = eball(VIRTUAL_WIDTH / 2 , VIRTUAL_HEIGHT / 2 - 2, 16, 16)
- ball[2] = eball(VIRTUAL_WIDTH / 1.9 , VIRTUAL_HEIGHT / 2 - 2, 16, 16)
- ball[3] = eball(VIRTUAL_WIDTH / 1.8, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
- ball[4] = eball(VIRTUAL_WIDTH / 2.2, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
- ball[5] = eball(VIRTUAL_WIDTH / 2.1, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
- myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y)
- mymenu = mainMenu()
-
- ballSpeed = 200
-
-
- ballDX = math.random(2) == 1 and 100 or -100
- ballDY = math.random(-50, 50)
-
- gameState = 'animation'
- end
- t = 0
- shakeDuration = 0
- shakeMagnitude = 1
- function startShake(duration, magnitude)
- t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5
- end
- function displayFPS()
- love.window.setTitle(love.timer.getFPS())
- if love.keyboard.isDown('space') then
- player1nukescore = 200
- end
- end
-
- function speedControl()
- if (ballSpeed > maxspeed and gameState == 'play') then
- ballSpeed = maxspeed
- end
- end
-
- function love.update(dt)
- staticanimatorcounter(dt)
- if debug then
- displayFPS()
- end
- if globalState == 'base' then
- basegame(dt)
- end
- if globalState == 'menu' then
- menumode(dt)
- end
- 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
- 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
- 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].x > VIRTUAL_WIDTH + ballSpeed*0.5) 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
-
- if (player1nukescore >= 20 and player1nukescore < 140) then
- potentialstrike1 = 1
- if (love.keyboard.isDown(p1control.super)) then
- player1striken = 1
- player1reverbav = 0
- --player1nukescore = 0
- end
- end
- if (player1nukescore >= 140) and timeIsSlow2 == false and timeIsSlow == false and maxBalls == 1 and ball[1].x < VIRTUAL_WIDTH/2 then player1reverbav = 1 if love.keyboard.isDown(p1control.counter) then powerControl(1, 'special') end end
- if (player1nukescore >= 200) then
- --sounds['nukeready']:play()
- potentialnuke1 = 1
- if (love.keyboard.isDown(p1control.super)) then
- sounds['nuke']:play()
- if areanuclear == 1 then maxspeed = maxspeed + 50 end
- areanuclear = 1
- potentialstrike1 = 0
- striken = 0
- 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
- player1nukescore = 0
- player1reverbav = 0
- potentialnuke1 = 0
- end
- end
-
- if (player2nukescore >= 20 and player2nukescore <= 140) then
- potentialstrike2 = 1
- if (AGAINST_AI == 0) then
- if (love.keyboard.isDown(p2control.super)) then
- player2striken = 1
- player2reverbav = 0
-
- end
- end
- end
- if (player2nukescore >= 140) and timeIsSlow == false and timeIsSlow2 == false and maxBalls == 1 and ball[1].x > VIRTUAL_WIDTH/2 then player2reverbav = 1
- if love.keyboard.isDown(p2control.counter) then sounds["time"]:play() player2reverbav = false timeIsSlow2 = true originalPaddle = paddle_SPEED originalSpeed = ballSpeed player2reverbav = 0 potentialnuke2 = 0 potentialstrike2 = 0 end end
- if (player2nukescore >= 200) then
- -- sounds['nukeready']:play()
- potentialnuke2 = 1
- if (love.keyboard.isDown(p2control.super) and AGAINST_AI == 0) then
- sounds['nuke']:play()
- if areanuclear == 1 then maxspeed = maxspeed + 50 end
- potentialstrike2 = 0
- areanuclear = 1
- player2reverbav = 0
- --player2nukescore = 0
- 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
- potentialnuke2 = 0
- 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
- if gameState == 'play' then
- --love.window.setTitle('VOID')
- for i = 1, maxBalls do
- if ball[i]:collides(player1) then
- if ((areanuclear == 0 and ((player1striken or player2striken) and (player1score > 9 or player2score > 9)))) then
- print("Calling animation")
- superanimator('tensehit', 1)
- end
- --gameState = 'quickanim'
- 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
- 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]:collides(player2) then
- --ameState = 'quickanim'
- t = 0
- shakeDuration = 1
- if ((areanuclear == 0 and ((player1striken or player2striken) and (player1score > 9 or player2score > 9)))) 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
-
- 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
- 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
-
- player1:update(dt)
- player2:update(dt)
- player3:update(dt)
- player4:update(dt)
-
- end
- function wallbreaker(x,y)
- if (gameState == 'editor') then
- for i, wall in ipairs(walls) do
-
-
- if math.abs(wall.wallx - x) < 10 and math.abs(wall.wally - y) < 10
- then
- table.remove(walls, i)
- end
- end
- end
- end
- function editor()
- if (gameState == 'editor')
- then
- local mx, my = love.mouse.getPosition()
- mx = mx * DIFFERENCE_X
- my = my * DIFFERENCE_Y
- if not blockinput then
- love.graphics.setColor(1,0,0,1)
- love.graphics.rectangle('fill',mx, my, 10, wall1width)
- love.graphics.setColor(1,1,1,1)
- end
- if (love.mouse.isDown(2)) then
- wallbreaker(mx, my)
- end
- if (love.mouse.isDown(3)) then
- table.insert(walls, newWall(mx,my, 10, wall1width))
- end
-
- for i, wall in ipairs(walls) do
- love.graphics.setColor(1,1,1,1)
- love.graphics.rectangle("fill", wall.wallx, wall.wally, 10, wall.wallheight)
- end
- end
- end
- function hardmanager(diff)
- selecting = 1
- if (diff == 'easy')
- then
- INDIC[1] = '>'
- AGAINST_AI = 1
- AI_SPEED = ballSet/10
- AI_STRIKEMOD = 100
- AI_NUKEMOD = 1000
- difficultyl = 200
- selecting = 0
- gameState = '1serve'
- globalState = 'base'
- end
- if (diff == 'normal')
- then
- INDIC[2] = '>'
- AI_SPEED = ballSet/10
- AI_LEVEL = 500
- AI_NUKEMOD = 250
- AI_STRIKEMOD = 60
- AGAINST_AI = 1
- difficultyl = 300
- selecting = 0
- gameState = '1serve'
- globalState = 'base'
- end
- if (diff == 'hard')
- then
- INDIC[3] = '>'
- AI_SPEED = ballSpeed * 1.1 + 50
- AI_SPEED = AI_SPEED / 10
- AI_LEVEL = 700
- AI_NUKEMOD = 200
- AI_STRIKEMOD = 20
- selecting = 0
- difficultyl = 350
- AGAINST_AI = 1
- gameState = '1serve'
- globalState = 'base'
- end
- if (diff == 'practice') then
- INDIC[3] = '>'
- AI_SPEED = ballSpeed * 500 + 50
- AI_SPEED = AI_SPEED / 10
- AI_LEVEL = 700
- AI_NUKEMOD = 9000000000
- AI_STRIKEMOD = 90000000
- selecting = 0
- difficultyl = 350
- AGAINST_AI = 1
- gameState = 'base'
- end
- end
-
-
- function dangerChecker() --CHECK IF CONTROLS ARE DUPLICATING
- if (p1control.up == p1control.down) then danger = '1up' danger2 = '1down'
- elseif (p1control.up == p1control.super) then danger = '1up' danger2 = '1special'
- elseif (p1control.up == p1control.counter) then danger = '1up' danger2 = '1ct'
- elseif (p1control.down == p1control.super) then danger = '1down' danger2 = '1special'
- elseif (p1control.down == p1control.counter) then danger = '1ct' danger2 = '1down'
- elseif (p1control.super == p1control.counter) then danger = '1special' danger2 = '1ct'
- elseif (p2control.down == p2control.up) then danger = '2down' danger2 = '2up'
- elseif (p2control.down == p2control.super) then danger = '2down' danger2 = '2special'
- elseif (p2control.down == p2control.counter) then danger = '2down' danger2 = '2ct'
- elseif (p2control.up == p2control.super) then danger = '2up' danger2 = '2special'
- elseif (p2control.up == p2control.counter) then danger = '2ct' danger2 = '2up'
- elseif (p2control.super == p2control.counter) then danger = '2special' danger2 = '2ct'
- else
- danger = "none"
- danger2 = "none"
- end
- end
- function love.keypressed(key)
- if gameState == 'assign' then
- if (req == 'p1up') then p1control.up = key
- currentKey = key
- --love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p2up') then p2control.up = key
- currentKey = key
- --love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p1down') then p1control.down = key
- currentKey = key
- --love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p2down') then p2control.down = key
- currentKey = key
- -- love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p1super') then p1control.super = key
- currentKey = key
- -- love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p2super') then p2control.super = key
- currentKey = key
- -- love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p1ct') then p1control.counter = key
- currentKey = key
- -- love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- if (req == 'p2ct') then p2control.counter = key
- currentKey = key
- --love.window.setTitle(key)
- gameState = 'controlSettings'
- end
- end
- if key == 'escape' then
- TEXT = 'Escape Key'
- love.event.quit()
- elseif key == 'enter' or key == 'return' then
-
- if gameState == 'start' then
- resettinggenius()
- gameState = 'menu'
- globalState = 'menu'
- hardmanager()
- elseif (gameState == 'done') then
- if (player1score > player2score) then
- gameState = '2serve'
- potentialnuke1 = 0
- potentialnuke2 = 0
- striken = 0
- if (nuckemodactive == 0) then
- areanuclear = 0
- nuclearanimation = 3
- end
- potentialstrike1 = 0
- potentialstrike2 = 0
- player1nukescore = 0
- player2nukescore = 0
- else
- gameState = '1serve'
- resettinggenius()
- for i = 1, maxBalls do
- ball[i]:reset(i)
- end
- end
- else
- gameState = 'menu'
- globalState = 'menu'
- if (love.math.random(0, 10) == 1)
- then
- TEXT = "Nuclear Ching Chong"
- else
- TEXT = 'Nuclear Pong'
- end
- resettinggenius()
- for i = 1, maxBalls do
- ball[i]:reset(i)
- end
- end
- end
-
- end
-
- function love.keyreleased(key)
- currentKey = " "
-
- end
- function speedSetter(requesttype)
- if (requesttype == 'ball') then
- if (ballSet > 550) then
- ballSet = 0
- paddle_SPEED = 0
-
- else
- ballSet = ballSet + 50
- paddle_SPEED = paddle_SPEED + 5
- end
- ballSpeed = ballSet
- end
- if (requesttype == 'snc') then
- synctype = synctype + 1
- if (synctype > 1) then
- synctype = 0
- end
-
- if synctype == 0 then synctext = 'Independent' end
- if synctype == 1 then synctext = 'Synchronised' end
- end
- if (requesttype == 'nuclearmod')
- then
-
- nuckemodactive = nuckemodactive + 1
- if (nuckemodactive > 1) then
-
- nuckemodactive = 0
- end
- if (nuckemodactive == 0)
- then
- areanuclear = 0
- nuclearanimation = 3
- ballSet = 200
- TEXT = "Nuclear Pong"
-
- synctype = 0
- maxspeed = 700
- synctext = 'Independent'
- paddle_SPEED = ballSet/10
- AI_SPEED = ballSet/10
-
- end
- if (nuckemodactive == 1)
- then
- areanuclear = 1
- ballSet = 2000
- maxspeed = 2000
- paddle_SPEED = ballSet/10
- AI_SPEED = ballSet/10
- synctext = "death is imminent"
- end
- ballSpeed = ballSet
- end
- if (requesttype == 'practice') then
- if (ballSpeed > 999) then
- ballSpeed = 200
- ballSet = 200
- end
- if (ballSpeed > 799) then
- prtext = 'Insane'
- maxBalls = 5
- elseif ballSpeed > 599 then
- prtext = 'Hard'
- maxBalls = 4
- elseif ballSpeed > 399 then
- prtext = 'Normal'
- maxBalls = 3
- elseif ballSpeed > 199 then
- prtext = 'Easy'
- maxBalls = 3
- end
- ballSpeed = ballSpeed + 200
- ballSet = ballSet + 200
- end
- if (requesttype == 'reset')
- then
- ballSpeed = 200
- ballSet = 200
- synctype = 0
- prtext = 'Easy'
- maxBalls = 1
- end
- if (requesttype == 'pc') then
- if (playerCount == 2) then
- playerCount = 1
- playertext = '1v1'
- elseif (playerCount == 1) then
- playerCount = playerCount + 1
- player3.x = player1.x + VIRTUAL_WIDTH / 2
- player3.y = player3.y
- playertext = '2v2'
- end
-
-
- end
- if (requesttype == 'ballz') then
- if (maxBalls > 1) then
- maxBalls = 1
- --love.window.setTitle("more than 4")
- else
- maxBalls = maxBalls + 1
- end
-
- end
- if requesttype == 'ptw' then
- if ptw == 10 then
- ptw = 1
- else
- ptw = ptw + 1
- end
- end
-
- end
-
- function gameModeChanger()
- if (gameState == 'gameMode') then
- local button_width = VIRTUAL_WIDTH * (1/3)
- local BUTTON_HEIGHT = 50
- local margin = 20
- local hot = false
- local cursor_y = 0
- local total_height = (BUTTON_HEIGHT + margin) * #buttons
- for i, button in ipairs(modeSelectorButtons) do
- button.last = button.now
- local bx = (VIRTUAL_WIDTH*0.5) - (button_width * 0.5)
- local by = (VIRTUAL_HEIGHT * 0.5) - (total_height * 0.5) + cursor_y
- local color = {255, 255, 255, 255}
- local mx, my = love.mouse.getPosition()
- mx = mx * DIFFERENCE_X
- my = my * DIFFERENCE_Y
- hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
- if (hot == i) then
- color = {10, 10, 0, 255}
- end
- button.now = love.mouse.isDown(1)
- if button.now and not button.last and hot == i then
- love.graphics.setColor(0,0,0,1)
- love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
- sounds['wallhit']:play()
- button.fn()
- end
- love.graphics.setColor(unpack(color))
- love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
- love.graphics.setColor(0, 0, 0, 255)
- local textW = smallfont:getWidth(button.text)
- local textH = smallfont:getHeight(button.text)
- love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- love.graphics.setColor(255, 255, 255, 255)
- cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
-
- end
- end
- if (gameState == 'multiMode')
- then
- local button_width = VIRTUAL_WIDTH * (1/3)
- local BUTTON_HEIGHT = 50
- local margin = 20
- local hot = false
- local cursor_y = 0
- local total_height = (BUTTON_HEIGHT + margin) * #buttons
- for i, button in ipairs(playerCountButtons) do
- button.last = button.now
-
- local bx = (VIRTUAL_WIDTH*0.5) - (button_width * 0.5)
-
- local by = (VIRTUAL_HEIGHT * 0.3) - (total_height * 0.5) + cursor_y
- if (button.text == 'Play') then
- by = by + by/1.8
- end
- local color = {255, 255, 255, 255}
- local mx, my = love.mouse.getPosition()
- mx = mx * DIFFERENCE_X
- my = my * DIFFERENCE_Y
- hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
- if (hot == i) then
- if (button.text == 'Play') then color = {0/255, 255/255, 0/255, 255} else
- color = {10, 10, 0, 255}
- end
- end
- button.now = love.mouse.isDown(1)
- if button.now and not button.last and hot == i then
- love.graphics.setColor(0,0,0,1)
- love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
- sounds['wallhit']:play()
- if button.text == "Ball Speed: " and nuckemodactive == 1 then
- else
-
- button.fn()
-
- end
- end
- love.graphics.setColor(unpack(color))
- love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
- love.graphics.setColor(0, 0, 0, 255)
- local textW = smallfont:getWidth(button.text)
- local textH = smallfont:getHeight(button.text)
- if (button.text == '1v1') then love.graphics.print(playertext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- elseif button.text == 'snc' then
- if (nuckemodactive == 1) then
- love.graphics.setColor(1,0,0,1)
- love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- love.graphics.setColor(1,1,1,1)
- love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- love.graphics.setColor(0,0,0,1)
- else
- --
- love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.45 - textW*0.5, by+textH*0.5)
- end
- elseif (button.text == 'ballCount') then love.graphics.print("Ball Count: " .. maxBalls, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- elseif (button.text == "Ball Speed: ") then
- if (nuckemodactive == 1) then
- love.graphics.setColor(1,0,0,1)
- love.graphics.print("shaitan machina", smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- love.graphics.setColor(1,1,1,1)
- love.graphics.print("shaitan machina", smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- love.graphics.setColor(0,0,0,1)
-
- else
- love.graphics.print(button.text .. ballSet, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- end
- elseif button.text == 'ptw' then love.graphics.print("Points to Win: " .. ptw, smallfont,VIRTUAL_WIDTH*0.5 - textW * 1.5, by+textH*0.5)
- else
- love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
- end
- love.graphics.setColor(255, 255, 255, 255)
- cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
-
- end
-
-
- end
-
-
- end
-
-
- function love.draw()
- simpleScale.set()
- --LEGACY CODE (INGORE)
- --resolutionChanger()
- --love.graphics.scale( 1.5, 1.5 )
- -- love.graphics.translate( (WINDOW_WIDTH*1.5 - WINDOW_WIDTH), WINDOW_HEIGHT*1.5 - WINDOW_HEIGHT )
- -- push:apply('start')
- --resolutionButtons()
-
- if gameState == 'nuclearExplosion' then --AWFUL WAY TO DO NUCLEAR EXPLOSIONS
- love.graphics.setColor(1,1,1,1)
- love.graphics.circle("fill", ball[1].x, ball[1].y , explosionRange*100, 100)
- player1.RED, player1.GREEN, player1.BLUE, player2.RED, player2.GREEN, player2.BLUE = nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3
- for i = 1, maxBalls do
- love.graphics.setColor(nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,1)
- ball[i]:render('controlled')
- end
- player1:render()
- player2:render()
- elseif gameState == 'animation' then
- callAnimator() --This calls a fucking 100 year old animator. I dont even remember what it does. This has nothing to do with the new one
- else
- mapChanger()
- if t < shakeDuration then
- local dx = love.math.random(-shakeMagnitude, shakeMagnitude)
- local dy = love.math.random(-shakeMagnitude, shakeMagnitude)
- love.graphics.translate(dx, dy)
- end
- if (gameState == 'menu') then
- updateTEXT = '0.7.1 Chalkboard Update'
- end
- serveBot()
- hardmanager()
-
- if (areanuclear == 1) then
- love.graphics.setShader(shader)
- love.graphics.clear(1,1,1,1)
- else
- love.graphics.setShader()
- love.graphics.clear(40/255, 40/255, 40/255, 1) --BACKGROUND COLOR
- end
- staticanimator()
- if (gameMode == 'practice') then
- love.graphics.rectangle('fill', VIRTUAL_WIDTH, 0, 10, VIRTUAL_HEIGHT)
- end
- if (MAP_TYPE == 1) then
- love.graphics.setColor(1, 0, 0.20, 1)
- love.graphics.rectangle('fill', VIRTUAL_WIDTH *0.5, 0, 10, VIRTUAL_HEIGHT * 0.3)
- love.graphics.rectangle('fill', VIRTUAL_WIDTH *0.5, VIRTUAL_HEIGHT * 0.7, 10, VIRTUAL_HEIGHT * 0.3)
- love.graphics.setColor(1, 1, 1, 1)
- end
- love.graphics.setFont(scorefont)
- if gameState == 'play' or gameState == '1serve' or gameState == '2serve' then
- love.graphics.setFont(smallfont)
- end
- love.graphics.setColor(1,1,1,1)
- love.graphics.printf(TEXT,0,20,VIRTUAL_WIDTH,'center')
- love.graphics.setFont(smallfont)
- love.graphics.printf(updateTEXT,0,VIRTUAL_HEIGHT * 0.95,VIRTUAL_WIDTH,'left')
- love.graphics.setFont(scorefont)
- love.graphics.print(tostring(math.floor(player1score)), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 12)
- if (gameMode ~= 'practice') then
- love.graphics.print(tostring(math.floor(player2score)), VIRTUAL_WIDTH / 2 + 400, VIRTUAL_HEIGHT / 12)
- end
- love.graphics.setFont(smallfont)
-
- if (potentialstrike1 == 1 and potentialnuke1 == 0 and player1reverbav == 0) then
- if (player1striken == 0) then
- love.graphics.print(tostring(math.floor(player1nukescore) .. '['..p1control.super..']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
- else
- love.graphics.print(tostring('READY'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
- end
- elseif (player1reverbav == 1 and potentialnuke1 == 0) then
- love.graphics.print(tostring(math.floor(player1nukescore) ..'[' ..p1control.super .. ']' .. " ["..p1control.counter..']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
- elseif (potentialnuke1 == 1) then
- love.graphics.setColor(255, 0, 0, 255)
- love.graphics.print(tostring(math.floor(player1nukescore) .. '[' .. p1control.super .. ']' .. " ["..p1control.counter .. ']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
- love.graphics.setColor(255, 255, 255, 255)
- else
- love.graphics.print(tostring(math.floor(player1nukescore)), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
- end
- if (potentialstrike2 == 1 and player2reverbav == 0) then
- if (player2striken == 0 and gameMode ~= 'practice') then
- love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
- elseif (gameMode ~= 'practice') then
- love.graphics.print(tostring('READY'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
- end
- elseif (potentialnuke2 == 1 and gameMode ~= 'practice') then
- love.graphics.setColor(255, 0, 0, 255)
- love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
- love.graphics.setColor(255, 255, 255, 255)
- elseif (player2reverbav == 1 and potentialnuke2 == 0) then
- love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super .. "] [" .. p2control.counter..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
- elseif (gameMode ~= 'practice') then
- love.graphics.print(tostring(math.floor(player2nukescore)), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
- end
- if (MAP_TYPE == 2) then
- for i, wall in ipairs(walls) do
-
- love.graphics.setColor(1,1,1,1)
- love.graphics.rectangle("fill", wall.wallx, wall.wally, 10, wall.wallheight)
- end
- end
-
- if gameState ~= 'assign' then
- player1:render()
- player3:render()
- if gameMode ~= 'practice' then
- player2:render()
- player4:render()
- end
- for i = 1, maxBalls do
- if areanuclear == 1 then
- ball[i]:render('black')
- --love.window.setTitle('rendering black')
- else
- ball[i]:render(' ')
- --love.window.setTitle('rendering white')
- end
- end
- if gameState == 'windowsettings' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, settings, sounds, 'right')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'editor' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, editorpicks, sounds, 'right')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'speedSettings' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, speedParameters, sounds, 'middle')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'controlSettings' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, controlSettings, sounds, 'control')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'gameMode' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, modeSelectorButtons, sounds, 'middle')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'menu' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, 'middle')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'difficulty' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, difbuttons, sounds, 'middle')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'multiMode' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, playerCountButtons, sounds, 'playercount')
- love.keyboard.mouseisReleased = false
- end
- if gameState == 'prdiff' then
- mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, pracdiff, sounds, 'playercount')
- love.keyboard.mouseisReleased = false
- end
- end
- editor()
- if (gameState == 'start') then
- love.graphics.push()
- love.graphics.translate(
- VIRTUAL_WIDTH * 0.4,
- VIRTUAL_HEIGHT * 0.5
- )
- love.graphics.rotate(rotation)
- love.graphics.setFont(smallfont)
- love.graphics.print("Press Enter to Start", WINDOW_WIDTH / -10 , VIRTUAL_HEIGHT / 8)
- love.graphics.setColor(255,255,255,255)
- love.graphics.pop()
-
-
- end
- end
- if gameState == 'assign' then
- controlChanger()
- end
- simpleScale.unSet()
- end
-
- --Check if controls are duplicating
- function controllerSer()
- for i = 1, maxBalls do
- if (ball[i].dy == 0) then
- hitNum[i] = hitNum[i] +1
- if hitNum[i] >= 10 then
- ball[i].dy = 1
- hitNum[i] = 0
- end
- else
- hitNum[i] = 0
- end
- end
- end
-
- function palleteController() --!!!!LEGACY CODE, MIGRATED TO Paddle.lua!!!!
- if (areanuclear == 0) then player1.RED = 1 player1.GREEN = 1 player1.BLUE = 1 end
- if (areanuclear == 0) then player2.RED = 1 player2.GREEN = 1 player2.BLUE = 1 end
- if (areanuclear == 1) then player1.RED = 0 player1.GREEN = 0 player1.BLUE = 0 end
- if (areanuclear == 1) then player2.RED = 0 player2.GREEN = 0 player2.BLUE = 0 end
- end
-
-
-
-
-
- function love.wheelmoved(x, y)
- if (y < 0 and wall1width > 0) then
- wall1width = wall1width - 5
- elseif y > 0 and wall1width < 900 then wall1width = wall1width + 5
- end
-
- end
-
- function serveBot() --THIS IS USED TO CHANGE TEXT/BALL DIRECTION ON DIFFERENT SERVES
- if (gameState == '1serve') then
- updateTEXT = ''
- if (gameMode ~= 'practice') then
- TEXT = 'PLAYER 1, serve!(q)'
- end
- if (love.keyboard.isDown('q') or gameMode == 'practice') then
- TEXT = 'Lets Begin!'
- ball_DIR = 1
- for i = 1, maxBalls do
- ball[i]:reset(i)
-
- end
-
- gameState = 'play'
- globalState = 'base'
- end
- end
- if (gameState == '2serve') then
- TEXT = 'PLAYER 2, serve!(p)'
- if (AGAINST_AI == 1) then
- TEXT = ''
- ball_DIR = -1
- for i = 1, maxBalls do
- ball[i]:reset(i)
- end
-
- gameState = 'play'
- globalState = 'base'
- end
- if (love.keyboard.isDown('p') and AGAINST_AI == 0) then
- TEXT = 'Lets Begin'
- ball_DIR = -1
- for i = 1, maxBalls do
- ball[i]:reset(i)
- end
- --love.window.setTitle("An atttttttt")
- gameState = 'play'
- globalState = 'base'
- end
- end
- end
- function mapChanger()
- for i = 1, maxBalls do
- if (gameState == 'editor') then MAP_TYPE = 2 end
- if (MAP_TYPE > 2) then
- MAP_TYPE = 0
- end
- if (gameMode == 'practice') then
- MAP_TYPE = 0
- if ball[i].x > VIRTUAL_WIDTH * 0.99 then
- soundtype = love.math.random(1, 5)
- sounds['wallhit']:setPitch(ballSpeed/250)
- sounds['wallhit']:play()
- if (ball[i].dx > 0)
- then ball[i].x = ball[i].x - 20
- else ball[i].x = ball[i].x + 20
- end
- ball[i].dx = -ball[i].dx
-
- end
-
- end
- if (MAP_TYPE == 1)
- then
- if ball[i].y < VIRTUAL_HEIGHT * 0.3 and ball[i].x > VIRTUAL_WIDTH * 0.5 and ball[i].x < VIRTUAL_WIDTH * 0.5 + 5 then
- soundtype = love.math.random(1, 5)
- sounds['wallhit']:setPitch(ballSpeed/250)
- sounds['wallhit']:play()
- if (ball[i].dx > 0)
- then ball[i].x = ball[i].x - 20
- else ball[i].x = ball[i].x + 20
- end
- ball[i].dx = -ball[i].dx
-
- end
- if ball[i].y > VIRTUAL_HEIGHT * 0.7 and ball[i].x > VIRTUAL_WIDTH * 0.5 and ball[i].x < VIRTUAL_WIDTH * 0.5 + 5 then
- soundtype = love.math.random(1, 5)
- sounds['wallhit']:setPitch(ballSpeed/250)
- sounds['wallhit']:play()
- if (ball[i].dx > 0)
- then ball[i].x = ball[i].x - 20
- else ball[i].x = ball[i].x + 20
- end
- ball[i].dx = -ball[i].dx
-
- end
- end
- if (MAP_TYPE == 2) then
- for i, wall in ipairs(walls) do
-
- if (ball[1].y > wall.wally and ball[1].y < wall.wally+wall.wallheight and ball[1].x > wall.wallx - ballSpeed/200 and ball[1].x < wall.wallx + 10 + ballSpeed/200) then
- controllerSer()
- soundtype = love.math.random(1, 5)
- sounds['wallhit']:setPitch(ballSpeed/250)
- sounds['wallhit']:play()
- if (ball[1].dx > 0)
- then ball[1].x = ball[1].x - 1
- else ball[1].x = ball[1].x + 1
- end
- ball[1].dx = -ball[1].dx
-
- elseif (ball[1].y > wall.wally-15 and ball[1].y < wall.wally+wall.wallheight+10 and ball[1].x > wall.wallx and ball[1].x < wall.wallx + 10) then
- controllerSer()
- soundtype = love.math.random(1, 5)
- sounds['wallhit']:setPitch(ballSpeed/250)
- sounds['wallhit']:play()
- if (ball[1].dy > 0)
- then ball[1].y = ball[1].y - 1
- else ball[1].y = ball[1].y + 1
- end
- ball[1].dy = -ball[1].dy
- end
- end
- end
- end
-
- end
- function resolutionChanger()
- if (RESOLUTION_SET > 1) then
- RESOLUTION_SET = 0
- end
- if (RESOLUTION_SET == 0 ) then
- if (isFullscreen == 1) then
- DIFFERENCE_X = 1
- DIFFERENCE_Y = 1
- simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT,{fullscreen = false})
- isFullscreen = 0
- end
-
- end
- if (RESOLUTION_SET == 1) then
- if (isFullscreen == 0) then
- simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true})
- local newWidth = love.graphics.getWidth()
- local newHeight = love.graphics.getHeight()
- DIFFERENCE_X = VIRTUAL_WIDTH / newWidth
- DIFFERENCE_Y = VIRTUAL_HEIGHT / newHeight
- isFullscreen = 1
-
- end
- end
-
-
- end
- function resettinggenius()
- maxBalls = 1
- for i =1, maxBalls do
- ball[i]:reset(i)
- end
- paddle_SPEED = 20
- nuclearanimation = 3
- timeIsSlow =false
- timeIsSlow2 = false
- originalSpeed = 200
- gameState = 'menu'
- globalState = 'menu'
- gameMode = 'notpracticd'
- ballSet = 200
- ballSpeed = ballSet
- player2.GREEN = 255
- player2.BLUE = 255
- player1.GREEN = 255
- player1.BLUE = 255
- player1score = 0
- player2score = 0
- potentialnuke1 = 0
- potentialnuke2 = 0
- striken = 0
- areanuclear = 0
- potentialstrike1 = 0
- potentialstrike2 = 0
- player1nukescore = 0
- player2nukescore = 0
- player1reverbav = 0
- player2reverbav = 0
- selecting = 0
- AGAINST_AI = 0
- end
-
- function callAnimator()
- love.graphics.setColor(255,255,255,light/255)
- love.graphics.draw(image,0,0)
- end
- function love.mousereleased(x, y, button)
- love.keyboard.mouseisReleased = true
- if (gameState == 'editor') then
- if (#walls < 1000 and button == 1 and blockinput ~= true) then
- table.insert(walls, newWall(x*DIFFERENCE_X,y*DIFFERENCE_Y, 10, wall1width))
- end
- end
- end
|