You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1904 lines
68 KiB

  1. Class = require 'class'
  2. require 'paddle'
  3. require 'simpleScale'
  4. require 'TSerial'
  5. require 'eball'
  6. require 'fullScreener'
  7. require 'mainMenu'
  8. require 'music'
  9. local serialize = require 'ser'
  10. local shader_code = [[
  11. vec4 effect(vec4 color, Image image, vec2 uvs, vec2 screen_coords) {
  12. vec4 pixel = Texel(image,uvs);
  13. return pixel * color;
  14. }
  15. ]]
  16. timeIsSlow = false
  17. timeIsSlow2 = false
  18. originalSpeed = 200
  19. explosionRange = 0
  20. blockinput = false
  21. wall1width = 30
  22. nuclearanimation = 3
  23. easternum = 0
  24. ball_DIR = 0
  25. RED = 255
  26. hitNum = {}
  27. hitNum[1] = 0
  28. hitNum[2] = 0
  29. hitNum[3] = 0
  30. hitNum[4] = 0
  31. p1bonus = 0
  32. p2bonus = 0
  33. hitNum[5] = 0
  34. hitNum[6] = 0
  35. GREEN = 255
  36. BLUE = 255
  37. updateTEXT = 'Chalkboard Update'
  38. maxBalls = 1
  39. playerCount = 1
  40. WINDOW_WIDTH = 1280
  41. WINDOW_HEIGHT = 720
  42. player1reverbav = 0
  43. playertext = '1v1'
  44. player2reverbav = 0
  45. elapsed = 0
  46. rotation = 0
  47. TEXT = 'Nuclear Pong'
  48. VIRTUAL_WIDTH = 1280
  49. VIRTUAL_HEIGHT = 720
  50. currentKey = " "
  51. ptw = 10
  52. danger = 'none'
  53. danger2 = 'none'
  54. nuckemodactive = 0
  55. maxspeed = 700
  56. DIFFERENCE_X = 1
  57. DIFFERENCE_Y = 1
  58. paddle_SPEED = 20
  59. textamount = 15
  60. AI_STRIKEMOD = 1000
  61. resolutionWin = 0
  62. AGAINST_AI = 0
  63. RESOLUTION_SET = 0
  64. AI_NUKEMOD = 1000
  65. animstart = true
  66. AI_SPEED = 30
  67. craz = 0
  68. AI_LEVEL = 500
  69. isFullscreen = 0
  70. prtext = 'Easy'
  71. MAP_TYPE = 2
  72. difficultyl = 300
  73. req = 'pp'
  74. ballSet = 200
  75. p1control = {up = 'a', down = 'z', super = 's', counter = 'x'}
  76. p2control = {up = ';', down = '.', super = 'l', counter = ','}
  77. synctext = "Independent"
  78. synctype = 0
  79. function newButton(text, fn)
  80. return {
  81. text = text,
  82. fn = fn,
  83. now = false,
  84. last = false
  85. }
  86. end
  87. function love.keyboard.mouseWasReleased()
  88. return love.keyboard.mouseisReleased
  89. end
  90. function autoSave(dt)
  91. autoTimer = autoTimer + dt
  92. end
  93. function balancer()
  94. if (player2score == 9 or player1score == 9) then
  95. shakeDuration = 10
  96. -- love.window.setTitle("ALMOST WIN")
  97. end
  98. if (player1score < player2score) then
  99. p1bonus = (player2score - player1score) * 5
  100. else
  101. p1bonus = 0
  102. end
  103. if (player2score < player1score) then
  104. p2bonus = (player1score - player2score) * 5
  105. else
  106. p2bonus = 0
  107. end
  108. end
  109. function newWall(wallx, wally, wallwidth, wallheight)
  110. return {
  111. wallx = wallx,
  112. wally = wally,
  113. walwidth = wallwidth,
  114. wallheight = wallheight
  115. }
  116. end
  117. speedParameters = {}
  118. buttons = {}
  119. difbuttons = {}
  120. settings = {}
  121. walls = {}
  122. editorpicks = {}
  123. controlSettings = {}
  124. modeSelectorButtons= {}
  125. pracdiff = {}
  126. playerCountButtons = {}
  127. function controlChanger()
  128. if (gameState == 'assign') then
  129. love.graphics.clear(50/255,50/255,50/255,255)
  130. love.graphics.printf('SELECT BUTTON',0,VIRTUAL_HEIGHT / 2,VIRTUAL_WIDTH,'center')
  131. end
  132. end
  133. function love.load()
  134. simpleScale.setWindow(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT)
  135. configfile = io.open('config.lua', "r")
  136. configsave = io.open('config.lua', "w")
  137. shader = love.graphics.newShader(shader_code)
  138. time_1 = 0
  139. --load
  140. testwalls = love.filesystem.load('save.lua')()
  141. if testwalls ~= nil then
  142. walls = love.filesystem.load('save.lua')()
  143. end
  144. light = 0
  145. image = love.graphics.newImage("Madi.png")
  146. table.insert(editorpicks, newButton("C", function() for k in pairs (walls) do walls[k] = nil end end))
  147. table.insert(editorpicks, newButton("S", function() love.filesystem.write('save.lua', serialize(walls)) end))
  148. table.insert(editorpicks, newButton("L", function() walls = love.filesystem.load('save.lua')() end))
  149. table.insert(buttons, newButton("Singleplayer", function() gameState = 'gameMode' end))
  150. table.insert(buttons, newButton("Multiplayer", function() gameState = 'multiMode' end))
  151. table.insert(buttons, newButton("Settings", function() AGAINST_AI = 0 gameState = 'windowsettings' end))
  152. table.insert(buttons, newButton("Exit", function() love.event.quit(0) end))
  153. table.insert(difbuttons, newButton("Easy", function() hardmanager('easy') end))
  154. table.insert(difbuttons, newButton("Normal", function() hardmanager('normal') end))
  155. table.insert(difbuttons, newButton("Hard", function() hardmanager('hard') end))
  156. table.insert(settings, newButton("Change Map", function() MAP_TYPE = MAP_TYPE + 1 end))
  157. table.insert(settings, newButton("Toggle Fullscreen", function() myscreen:toggle(VIRTUAL_HEIGHT, VIRTUAL_WIDTH) DIFFERENCE_X = myscreen.c DIFFERENCE_Y = myscreen.d end))
  158. table.insert(settings, newButton("Editor", function() gameState = 'editor' end))
  159. table.insert(settings, newButton("Speed Settings", function() gameState = 'speedSettings' end))
  160. table.insert(settings, newButton("Control Settings", function() gameState = 'controlSettings' end))
  161. table.insert(settings, newButton("Back to Menu", function() gameState = 'menu' end))
  162. table.insert(speedParameters, newButton("Back to Menu", function() gameState = 'windowsettings' end))
  163. --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end))
  164. table.insert(playerCountButtons, newButton("Ball Speed: ", function() speedSetter('ball') end))
  165. --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end))
  166. table.insert(playerCountButtons, newButton("snc", function() speedSetter('snc') end))
  167. table.insert(speedParameters, newButton("NUCLEAR MODE", function() speedSetter('nuclearmod') end))
  168. table.insert(controlSettings, newButton("1up", function() gameState = 'assign' req = 'p1up' end))
  169. table.insert(controlSettings, newButton("1down", function() gameState = 'assign' req = 'p1down' end))
  170. table.insert(controlSettings, newButton("1special",function() gameState = 'assign' req = 'p1super' end))
  171. table.insert(controlSettings, newButton("1ct", function() gameState = 'assign' req = 'p1ct' end))
  172. table.insert(controlSettings, newButton("2up", function() gameState = 'assign' req = 'p2up' end))
  173. table.insert(controlSettings, newButton("2down", function() gameState = 'assign' req = 'p2down' end))
  174. table.insert(controlSettings, newButton("2special", function() gameState = 'assign' req = 'p2super' end))
  175. table.insert(controlSettings, newButton("2ct", function() gameState = 'assign' req = 'p2ct' end))
  176. table.insert(controlSettings, newButton("Default", function() p1control = {up = 'a', down = 'z', super = 's', counter = 'x'} p2control = {up = ';', down = '.', super = 'l', counter = ','} end))
  177. table.insert(controlSettings, newButton("Return", function() gameState = 'windowsettings' end))
  178. table.insert(modeSelectorButtons, newButton("Nuclear Pong", function() gameState = 'difficulty' end))
  179. table.insert(modeSelectorButtons, newButton("Nuclear Practice", function() gameState = 'prdiff' end))
  180. table.insert(modeSelectorButtons, newButton("Main Menu", function() gameState = 'menu' end))
  181. table.insert(pracdiff, newButton("Silverblade", function() speedSetter('practice') end))
  182. table.insert(pracdiff, newButton("Return", function() speedSetter('reset') gameState = 'gameMode' end))
  183. table.insert(pracdiff, newButton("Go!", function() gameMode = 'practice' hardmanager('practice') end))
  184. --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end))
  185. table.insert(playerCountButtons, newButton("ballCount", function() speedSetter('ballz') end))
  186. table.insert(playerCountButtons, newButton("Return", function() speedSetter('reset') gameState = 'menu' end))
  187. table.insert(playerCountButtons, newButton("ptw", function() speedSetter('ptw') end))
  188. table.insert(playerCountButtons, newButton("Play", function() AGAINST_AI = 0 gameState = '1serve' end))
  189. --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter() end))
  190. love.window.setTitle('NUCLEAR PONG')
  191. textphrases = {
  192. "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"
  193. }
  194. sounds = {
  195. ['updateMusic'] = love.audio.newSource("audio/theme1.mp3", "static"),
  196. ['gayTheme'] = love.audio.newSource("audio/theme2.mp3", "static"),
  197. ['gayTheme2'] = love.audio.newSource("audio/theme3.mp3", "static"),
  198. ['gayTheme3'] = love.audio.newSource("audio/theme4.mp3", "static"),
  199. ['beep'] = love.audio.newSource("audio/hit1.mp3", "static"),
  200. ['wallhit'] = love.audio.newSource("audio/hit2.wav", "static"),
  201. ['win'] = love.audio.newSource("win.wav", "static"),
  202. ['score'] = love.audio.newSource("audio/score.wav", "static"),
  203. ['nuke'] = love.audio.newSource("audio/bomb.wav", "static"),
  204. ['striking'] = love.audio.newSource("audio/superhit.wav", "static"),
  205. ['nuclearhit'] = love.audio.newSource("audio/hit1.mp3", "static"),
  206. ['time'] = love.audio.newSource("audio/time.wav", "static")
  207. }
  208. love.graphics.setDefaultFilter('nearest', 'nearest')
  209. --comic sans lmao
  210. math.randomseed(os.time())
  211. smallfont = love.graphics.newFont('font.ttf', 30)
  212. scorefont = love.graphics.newFont('font.ttf', 90)
  213. love.graphics.setFont(smallfont)
  214. --push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
  215. -- fullscreen = isFullscreen,
  216. -- resizable = true,
  217. -- vsync = true,
  218. --})
  219. player1score = 0
  220. player2score = 0
  221. areanuclear = 0
  222. player1nukescore = 0
  223. player2nukescore = 0
  224. striken = 0
  225. soundtype = 1
  226. soundturn = 1
  227. potentialstrike1 = 0
  228. potentialstrike2 = 0
  229. potentialnuke1 = 0
  230. potentialnuke2 = 0
  231. player1striken = 0
  232. player2striken = 0
  233. randomtext = 0
  234. selecting = 0
  235. number = 0
  236. elec = 1
  237. INDIC = {
  238. '', '', '', ''
  239. }
  240. --playe1nuke
  241. player1 = paddle(0,30,10,100, 1)
  242. player2 = paddle(VIRTUAL_WIDTH * 0.99, VIRTUAL_HEIGHT * 0.88, 10, 100, 2)
  243. player3 = paddle(5000, 5000, 10, 100)
  244. player4 = paddle(5000, 5000, 10, 100)
  245. ball = {}
  246. ball[1] = eball(VIRTUAL_WIDTH / 2 , VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  247. ball[2] = eball(VIRTUAL_WIDTH / 1.9 , VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  248. ball[3] = eball(VIRTUAL_WIDTH / 1.8, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  249. ball[4] = eball(VIRTUAL_WIDTH / 2.2, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  250. ball[5] = eball(VIRTUAL_WIDTH / 2.1, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  251. myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y)
  252. mymenu = mainMenu()
  253. ballSpeed = 200
  254. ballDX = math.random(2) == 1 and 100 or -100
  255. ballDY = math.random(-50, 50)
  256. gameState = 'animation'
  257. end
  258. t = 0
  259. shakeDuration = 0
  260. shakeMagnitude = 1
  261. function startShake(duration, magnitude)
  262. t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5
  263. end
  264. function displayFPS()
  265. --love.window.setTitle(maxBalls)
  266. end
  267. function speedControl()
  268. if (ballSpeed > maxspeed and gameState == 'play') then
  269. ballSpeed = maxspeed
  270. end
  271. end
  272. function love.update(dt)
  273. displayFPS()
  274. if areanuclear == 1 then
  275. if nuclearanimation > 0 then
  276. gameState = 'nuclearExplosion'
  277. nuclearanimation = nuclearanimation - dt
  278. explosionRange = explosionRange + dt*24
  279. elseif (gameState ~= 'play') then
  280. gameState = 'play'
  281. explosionRange = 0
  282. end
  283. end
  284. if player1nukescore > 300 then
  285. player1nukescore = 300 end
  286. if player2nukescore > 300 then
  287. player2nukescore = 300 end
  288. speedControl()
  289. balancer()
  290. dangerChecker()
  291. musicController('norm', 1)
  292. palleteController()
  293. if (gameState == 'animation') then
  294. animator(dt)
  295. end
  296. if t < shakeDuration then
  297. t = t + dt
  298. end
  299. elapsed = elapsed + dt
  300. rotation = math.sin(elapsed * 2.5) * 0.7
  301. -- if (gameState == 'quickanim') then
  302. -- time_1 = time_1 + dt
  303. -- light = 255 - time_1 * 150
  304. -- if (light < 0) then
  305. -- time_1 = 0
  306. -- light = 0
  307. -- gameState = 'play'
  308. --end
  309. -- end
  310. for i=1, maxBalls do
  311. if (AGAINST_AI == 1 or gameState == 'start') then
  312. for i = 1, maxBalls do
  313. if (ball[i].y - player2.y >= 50 and player2.x - ball[i].x < AI_LEVEL) then
  314. player2.dy = AI_SPEED
  315. elseif (player2.y - ball[i].y >= -20 and player2.x - ball[i].x < AI_LEVEL) then
  316. player2.dy = -AI_SPEED
  317. else
  318. player2.dy = 0
  319. end
  320. if difficultyl == 350 and player2reverbav == true and VIRTUAL_WIDTH - ball[i].x < 90 and math.abs(ball[i].y - player2.y) > 150 then
  321. sounds["time"]:play() player2reverbav = false timeIsSlow2 = true originalPaddle = paddle_SPEED originalSpeed = ballSpeed player2reverbav = 0 potentialnuke2 = 0 potentialstrike2 = 0
  322. end
  323. if (player2nukescore > AI_STRIKEMOD and striken == 0)
  324. then
  325. player2striken = 1
  326. elseif (player2nukescore > AI_NUKEMOD and striken == 1)
  327. then
  328. if (areanuclear == 1) then maxspeed = maxspeed + 50 end
  329. sounds['nuke']:play()
  330. potentialstrike2 = 0
  331. areanuclear = 1
  332. ballSpeed = ballSpeed * 2
  333. if (synctype == 0)
  334. then
  335. paddle_SPEED = paddle_SPEED * 2 end
  336. if (synctype == 1)
  337. then
  338. paddle_SPEED = ballSpeed/10
  339. end
  340. if (synctype == 0)
  341. then
  342. AI_SPEED = AI_SPEED * 2.2 end
  343. if (synctype == 1)
  344. then
  345. AI_SPEED = ballSpeed * 1.1 /10
  346. end
  347. player2nukescore = 0
  348. player2reverbav = 0
  349. potentialnuke2 = 0
  350. end
  351. end
  352. end
  353. if (ball[i].x < 0 - ballSpeed*0.5) then
  354. if (gameMode ~= 'practice') then
  355. sounds['score']:play()
  356. end
  357. if (nuckemodactive == 0) then
  358. areanuclear = 0
  359. nuclearanimation = 3
  360. end
  361. striken = 0
  362. player1striken = 0
  363. player2striken = 0
  364. ballSpeed = ballSet
  365. if (synctype == 0)
  366. then
  367. paddle_SPEED = ballSet/10 end
  368. if (synctype == 1)
  369. then
  370. paddle_SPEED = ballSpeed/10
  371. end
  372. AI_SPEED = difficultyl/10
  373. player2score = player2score + 1
  374. if (player2score ==ptw and gameMode ~= 'practice') then
  375. for i = 1, maxBalls do
  376. ball[i]:reset(i)
  377. end
  378. sounds['win']:play()
  379. gameState = 'done'
  380. TEXT = 'Player 2 Won!'
  381. else
  382. gameState = '1serve'
  383. serveBot()
  384. for i = 1, maxBalls do
  385. ball[i]:reset(i)
  386. end
  387. end
  388. end
  389. if (ball[i].x > VIRTUAL_WIDTH + ballSpeed*0.5) then
  390. sounds['score']:play()
  391. if (nuckemodactive == 0) then
  392. areanuclear = 0
  393. nuclearanimation = 3
  394. end
  395. striken = 0
  396. player1striken = 0
  397. player2striken = 0
  398. ballSpeed = ballSet
  399. if (synctype == 0)
  400. then
  401. paddle_SPEED = ballSet/10
  402. AI_SPEED = ballSet/10 end
  403. if (synctype == 1)
  404. then
  405. paddle_SPEED = ballSpeed/10
  406. AI_SPEED = ballSpeed/10
  407. end
  408. AI_SPEED = difficultyl/10
  409. player1score = player1score + 1
  410. if (player1score == ptw) then
  411. ball[i]:reset(i)
  412. sounds['win']:play()
  413. gameState = 'done'
  414. TEXT = 'Player 1 Won!'
  415. else
  416. gameState = '2serve'
  417. serveBot()
  418. ball[i]:reset(i)
  419. end
  420. end
  421. end
  422. if (player1nukescore >= 20 and player1nukescore < 140) then
  423. potentialstrike1 = 1
  424. if (love.keyboard.isDown(p1control.super)) then
  425. player1striken = 1
  426. player1reverbav = 0
  427. --player1nukescore = 0
  428. end
  429. end
  430. 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
  431. if (player1nukescore >= 200) then
  432. --sounds['nukeready']:play()
  433. potentialnuke1 = 1
  434. if (love.keyboard.isDown(p1control.super)) then
  435. sounds['nuke']:play()
  436. if areanuclear == 1 then maxspeed = maxspeed + 50 end
  437. areanuclear = 1
  438. potentialstrike1 = 0
  439. striken = 0
  440. ballSpeed = ballSpeed * 2
  441. if (synctype == 0)
  442. then
  443. paddle_SPEED = paddle_SPEED * 2 end
  444. if (synctype == 1)
  445. then
  446. paddle_SPEED = ballSpeed/10
  447. end
  448. if (synctype == 0)
  449. then
  450. AI_SPEED = AI_SPEED * 2.2 end
  451. if (synctype == 1)
  452. then
  453. AI_SPEED = ballSpeed * 1.1 /10
  454. end
  455. player1nukescore = 0
  456. player1reverbav = 0
  457. potentialnuke1 = 0
  458. end
  459. end
  460. if (player2nukescore >= 20 and player2nukescore <= 140) then
  461. potentialstrike2 = 1
  462. if (AGAINST_AI == 0) then
  463. if (love.keyboard.isDown(p2control.super)) then
  464. player2striken = 1
  465. player2reverbav = 0
  466. end
  467. end
  468. end
  469. if (player2nukescore >= 140) and timeIsSlow == false and timeIsSlow2 == false and maxBalls == 1 and ball[1].x > VIRTUAL_WIDTH/2 then player2reverbav = 1
  470. 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
  471. if (player2nukescore >= 200) then
  472. -- sounds['nukeready']:play()
  473. potentialnuke2 = 1
  474. if (love.keyboard.isDown(p2control.super) and AGAINST_AI == 0) then
  475. sounds['nuke']:play()
  476. if areanuclear == 1 then maxspeed = maxspeed + 50 end
  477. potentialstrike2 = 0
  478. areanuclear = 1
  479. player2reverbav = 0
  480. --player2nukescore = 0
  481. ballSpeed = ballSpeed * 2
  482. if (synctype == 0)
  483. then
  484. paddle_SPEED = paddle_SPEED * 2 end
  485. if (synctype == 1)
  486. then
  487. paddle_SPEED = ballSpeed/10
  488. end
  489. if (synctype == 0)
  490. then
  491. AI_SPEED = AI_SPEED * 2.2 end
  492. if (synctype == 1)
  493. then
  494. AI_SPEED = ballSpeed * 1.1 / 10
  495. end
  496. player2nukescore = 0
  497. potentialnuke2 = 0
  498. end
  499. end
  500. if (love.keyboard.isDown(p1control.up))
  501. then
  502. player1.dy = (paddle_SPEED + p1bonus) * -1
  503. elseif (love.keyboard.isDown(p1control.down))
  504. then
  505. player1.dy = paddle_SPEED + p1bonus
  506. else
  507. player1.dy = 0
  508. end
  509. if (AGAINST_AI == 0) then
  510. if (love.keyboard.isDown(p2control.up))
  511. then
  512. player2.dy = (paddle_SPEED + p2bonus) * -1
  513. elseif (love.keyboard.isDown(p2control.down))
  514. then
  515. player2.dy = paddle_SPEED + p2bonus
  516. else
  517. player2.dy = 0
  518. end
  519. end
  520. if gameState == 'play' then
  521. --love.window.setTitle('VOID')
  522. for i = 1, maxBalls do
  523. if ball[i]:collides(player1) then
  524. --gameState = 'quickanim'
  525. if gameMode == 'practice' then
  526. player1score = player1score + 1
  527. end
  528. t = 0
  529. if (ballSpeed > 200) then
  530. shakeMagnitude = ballSpeed/200
  531. else shakeMagnitude = 0 end
  532. shakeDuration = 1
  533. randomtext = love.math.random(1, #textphrases)
  534. TEXT = textphrases[randomtext]
  535. soundtype = love.math.random(1, 1.2)
  536. if (player1striken == 1) then
  537. TEXT = 'PLAYER 1 STRIKES'
  538. ballSpeed = ballSpeed + player1nukescore
  539. potentialnuke1 = 0
  540. player1striken = 0
  541. player1nukescore = 0
  542. potentialstrike1 = 0
  543. striken = 1
  544. if areanuclear == 0 then
  545. sounds['striking']:setPitch(ballSpeed/250)
  546. sounds['striking']:play()
  547. else
  548. sounds['nuclearhit']:setPitch(1)
  549. sounds['nuclearhit']:play()
  550. end
  551. else
  552. if areanuclear == 0 then
  553. sounds['beep']:setPitch(ballSpeed/250)
  554. sounds['beep']:play()
  555. else
  556. sounds['nuclearhit']:setPitch(1)
  557. sounds['nuclearhit']:play()
  558. end
  559. end
  560. if (striken == 1) then
  561. player1nukescore = player1nukescore * 1.2
  562. if (synctype == 0)
  563. then
  564. paddle_SPEED = paddle_SPEED * 1.10
  565. elseif (synctype == 1)
  566. then
  567. paddle_SPEED = ballSpeed / 10
  568. end
  569. if (synctype == 0)
  570. then
  571. AI_SPEED = AI_SPEED * 1.10 end
  572. if (synctype == 1)
  573. then
  574. AI_SPEED = ballSpeed * 1.1/10
  575. end
  576. ballSpeed = ballSpeed * 1.10
  577. end
  578. player1nukescore = player1nukescore + 10
  579. ball[i].dx = -ball[i].dx
  580. ball[i].x = player1.x + 30
  581. if (love.keyboard.isDown(p1control.up)) then
  582. select = math.random(1,5)
  583. if select == 1 then
  584. ball[i].dy = -1
  585. elseif select == 2 then
  586. ball[i].dy = -1.2
  587. elseif select == 3 then
  588. ball[i].dy = -1.5
  589. elseif select == 4 then
  590. ball[i].dy = -1.8
  591. elseif select == 5 then
  592. ball[i].dy = -2
  593. end
  594. elseif love.keyboard.isDown(p1control.down) then
  595. select = math.random(1,5)
  596. if select == 1 then
  597. ball[i].dy = 1
  598. elseif select == 2 then
  599. ball[i].dy = 1.2
  600. elseif select == 3 then
  601. ball[i].dy = 1.5
  602. elseif select == 4 then
  603. ball[i].dy = 1.8
  604. elseif select == 5 then
  605. ball[i].dy = 2
  606. end
  607. else
  608. if ball[i].dy < 0 then
  609. select = math.random(1,5)
  610. if select == 1 then
  611. ball[i].dy = -1
  612. elseif select == 2 then
  613. ball[i].dy = -1.2
  614. elseif select == 3 then
  615. ball[i].dy = -1.5
  616. elseif select == 4 then
  617. ball[i].dy = -1.8
  618. elseif select == 5 then
  619. ball[i].dy = -2
  620. end
  621. else
  622. select = math.random(1,5)
  623. if select == 1 then
  624. ball[i].dy = 1
  625. elseif select == 2 then
  626. ball[i].dy = 1.2
  627. elseif select == 3 then
  628. ball[i].dy = 1.5
  629. elseif select == 4 then
  630. ball[i].dy = 1.8
  631. elseif select == 5 then
  632. ball[i].dy = 2
  633. end
  634. end
  635. end
  636. end
  637. if ball[i]:collides(player3) then
  638. --gameState = 'quickanim'
  639. if gameMode == 'practice' then
  640. player1score = player1score + 1
  641. end
  642. t = 0
  643. if (ballSpeed > 200) then
  644. shakeMagnitude = ballSpeed/200
  645. else shakeMagnitude = 0 end
  646. shakeDuration = 1
  647. randomtext = love.math.random(1, #textphrases)
  648. TEXT = textphrases[randomtext]
  649. soundtype = love.math.random(1, 1.2)
  650. if (player1striken == 1) then
  651. TEXT = 'PLAYER 1 STRIKES'
  652. ballSpeed = ballSpeed + player1nukescore
  653. potentialnuke1 = 0
  654. player1striken = 0
  655. player1nukescore = 0
  656. potentialstrike1 = 0
  657. striken = 1
  658. if areanuclear == 0 then
  659. sounds['striking']:setPitch(ballSpeed/250)
  660. sounds['striking']:play()
  661. else
  662. sounds['nuclearhit']:setPitch(1)
  663. sounds['nuclearhit']:play()
  664. end
  665. else
  666. if areanuclear == 0 then
  667. sounds['beep']:setPitch(ballSpeed/250)
  668. sounds['beep']:play()
  669. else
  670. sounds['nuclearhit']:setPitch(1)
  671. sounds['nuclearhit']:play()
  672. end
  673. end
  674. if (striken == 1) then
  675. player1nukescore = player1nukescore * 1.5
  676. if (synctype == 0)
  677. then
  678. paddle_SPEED = paddle_SPEED * 1.10
  679. elseif (synctype == 1)
  680. then
  681. paddle_SPEED = ballSpeed /10
  682. end
  683. if (synctype == 0)
  684. then
  685. AI_SPEED = AI_SPEED * 1.10 end
  686. if (synctype == 1)
  687. then
  688. AI_SPEED = ballSpeed * 1.1 /10
  689. end
  690. ballSpeed = ballSpeed * 1.10
  691. end
  692. player1nukescore = player1nukescore + 10
  693. ball[i].dx = -ball[i].dx
  694. ball[i].x = player1.x + 30
  695. if (love.keyboard.isDown(p1control.up)) then
  696. ball[i].dy = math.random(-2, -1)
  697. elseif love.keyboard.isDown(p1control.down) then
  698. ball[i].dy = math.random(1, 2)
  699. else
  700. if ball[i].dy < 0 then
  701. ball[i].dy = math.random(-2, -1)
  702. else
  703. ball[i].dy = math.random(1, 2)
  704. end
  705. end
  706. end
  707. if ball[i]:collides(player2) then
  708. --ameState = 'quickanim'
  709. t = 0
  710. shakeDuration = 1
  711. if (ballSpeed > 200) then
  712. shakeMagnitude = ballSpeed/200
  713. else
  714. shakeMagnitude = 0 end
  715. randomtext = love.math.random(1, #textphrases)
  716. TEXT = textphrases[randomtext]
  717. soundtype = love.math.random(1, 1.2)
  718. if (player2striken == 1) then
  719. TEXT = 'PLAYER 2 STRIKES'
  720. ballSpeed = ballSpeed + player2nukescore
  721. striken=1
  722. player2striken = 0
  723. potentialnuke2 = 0
  724. player2nukescore = 0
  725. potentialstrike2 = 0
  726. if areanuclear == 0 then
  727. sounds['striking']:setPitch(ballSpeed/250)
  728. sounds['striking']:play()
  729. else
  730. sounds['nuclearhit']:setPitch(1)
  731. sounds['nuclearhit']:play()
  732. end
  733. elseif (striken == 1) then
  734. player2nukescore = player2nukescore * 1.5
  735. if (synctype == 0) then paddle_SPEED = paddle_SPEED * 1.10 end
  736. if (synctype == 1) then paddle_SPEED = ballSpeed/10 end
  737. if (synctype == 0)
  738. then
  739. AI_SPEED = AI_SPEED * 1.10 end
  740. if (synctype == 1)
  741. then
  742. AI_SPEED = ballSpeed * 1.1 / 10
  743. end
  744. ballSpeed = ballSpeed * 1.10
  745. if areanuclear == 0 then
  746. sounds['beep']:setPitch(ballSpeed/250)
  747. sounds['beep']:play()
  748. else
  749. sounds['nuclearhit']:setPitch(1)
  750. sounds['nuclearhit']:play()
  751. end
  752. else
  753. if areanuclear == 0 then
  754. sounds['beep']:setPitch(ballSpeed/250)
  755. sounds['beep']:play()
  756. else
  757. sounds['nuclearhit']:setPitch(1)
  758. sounds['nuclearhit']:play()
  759. end
  760. end
  761. player2nukescore = player2nukescore + 10
  762. ball[i].dx = -ball[i].dx
  763. ball[i].x = player2.x - 30
  764. if (love.keyboard.isDown(p2control.up) or AI_SPEED < 0) then
  765. select = math.random(1,5)
  766. if select == 1 then
  767. ball[i].dy = -1
  768. elseif select == 2 then
  769. ball[i].dy = -1.2
  770. elseif select == 3 then
  771. ball[i].dy = -1.5
  772. elseif select == 4 then
  773. ball[i].dy = -1.8
  774. elseif select == 5 then
  775. ball[i].dy = -2
  776. end
  777. elseif love.keyboard.isDown(p2control.down) or AI_SPEED > 0 then
  778. select = math.random(1,5)
  779. if select == 1 then
  780. ball[i].dy = 1
  781. elseif select == 2 then
  782. ball[i].dy = 1.2
  783. elseif select == 3 then
  784. ball[i].dy = 1.5
  785. elseif select == 4 then
  786. ball[i].dy = 1.8
  787. elseif select == 5 then
  788. ball[i].dy = 2
  789. end
  790. else
  791. if ball[i].dy < 0 then
  792. select = math.random(1,5)
  793. if select == 1 then
  794. ball[i].dy = -1
  795. elseif select == 2 then
  796. ball[i].dy = -1.2
  797. elseif select == 3 then
  798. ball[i].dy = -1.5
  799. elseif select == 4 then
  800. ball[i].dy = -1.8
  801. elseif select == 5 then
  802. ball[i].dy = -2
  803. end
  804. else
  805. select = math.random(1,5)
  806. if select == 1 then
  807. ball[i].dy = 1
  808. elseif select == 2 then
  809. ball[i].dy = 1.2
  810. elseif select == 3 then
  811. ball[i].dy = 1.5
  812. elseif select == 4 then
  813. ball[i].dy = 1.8
  814. elseif select == 5 then
  815. ball[i].dy = 2
  816. end
  817. end
  818. end
  819. end
  820. if ball[i]:collides(player4) then
  821. --ameState = 'quickanim'
  822. t = 0
  823. shakeDuration = 1
  824. if (ballSpeed > 200) then
  825. shakeMagnitude = ballSpeed/200
  826. else
  827. shakeMagnitude = 0 end
  828. randomtext = love.math.random(1, #textphrases)
  829. TEXT = textphrases[randomtext]
  830. soundtype = love.math.random(1, 1.2)
  831. if (player2striken == 1) then
  832. TEXT = 'PLAYER 2 STRIKES'
  833. ballSpeed = ballSpeed + player2nukescore
  834. striken=1
  835. player2striken = 0
  836. potentialnuke2 = 0
  837. player2nukescore = 0
  838. potentialstrike2 = 0
  839. if areanuclear == 0 then
  840. sounds['striking']:setPitch(ballSpeed/250)
  841. sounds['striking']:play()
  842. else
  843. sounds['nuclearhit']:setPitch(1)
  844. sounds['nuclearhit']:play()
  845. end
  846. elseif (striken == 1) then
  847. player2nukescore = player2nukescore * 1.5
  848. if (synctype == 0) then paddle_SPEED = paddle_SPEED * 1.10 end
  849. if (synctype == 1) then paddle_SPEED = ballSpeed/10 end
  850. if (synctype == 0)
  851. then
  852. AI_SPEED = AI_SPEED * 1.10 end
  853. if (synctype == 1)
  854. then
  855. AI_SPEED = ballSpeed * 1.1 / 10
  856. end
  857. ballSpeed = ballSpeed * 1.10
  858. if areanuclear == 0 then
  859. sounds['beep']:setPitch(ballSpeed/250)
  860. sounds['beep']:play()
  861. else
  862. sounds['nuclearhit']:setPitch(1)
  863. sounds['nuclearhit']:play()
  864. end
  865. else
  866. if areanuclear == 0 then
  867. sounds['beep']:setPitch(ballSpeed/250)
  868. sounds['beep']:play()
  869. else
  870. sounds['nuclearhit']:setPitch(1)
  871. sounds['nuclearhit']:play()
  872. end
  873. end
  874. player2nukescore = player2nukescore + 10
  875. ball[i].dx = -ball[i].dx
  876. ball[i].x = player2.x - 30
  877. if (love.keyboard.isDown(p2control.up) or AI_SPEED < 0) then
  878. select = math.random(1,5)
  879. if select == 1 then
  880. ball[i].dy = -1
  881. elseif select == 2 then
  882. ball[i].dy = -1.2
  883. elseif select == 3 then
  884. ball[i].dy = -1.5
  885. elseif select == 4 then
  886. ball[i].dy = -1.8
  887. elseif select == 5 then
  888. ball[i].dy = -2
  889. end
  890. elseif love.keyboard.isDown(p2control.down) or AI_SPEED > 0 then
  891. select = math.random(1,5)
  892. if select == 1 then
  893. ball[i].dy = 1
  894. elseif select == 2 then
  895. ball[i].dy = 1.2
  896. elseif select == 3 then
  897. ball[i].dy = 1.5
  898. elseif select == 4 then
  899. ball[i].dy = 1.8
  900. elseif select == 5 then
  901. ball[i].dy = 2
  902. end
  903. else
  904. if ball[i].dy < 0 then
  905. select = math.random(1,5)
  906. if select == 1 then
  907. ball[i].dy = -1
  908. elseif select == 2 then
  909. ball[i].dy = -1.2
  910. elseif select == 3 then
  911. ball[i].dy = -1.5
  912. elseif select == 4 then
  913. ball[i].dy = -1.8
  914. elseif select == 5 then
  915. ball[i].dy = -2
  916. end
  917. else
  918. select = math.random(1,5)
  919. if select == 1 then
  920. ball[i].dy = 1
  921. elseif select == 2 then
  922. ball[i].dy = 1.2
  923. elseif select == 3 then
  924. ball[i].dy = 1.5
  925. elseif select == 4 then
  926. ball[i].dy = 1.8
  927. elseif select == 5 then
  928. ball[i].dy = 2
  929. end
  930. end
  931. end
  932. end
  933. if ball[i].y <= 0 then
  934. soundtype = love.math.random(1, 5)
  935. sounds['wallhit']:setPitch(ballSpeed/250)
  936. sounds['wallhit']:play()
  937. ball[i].y = 0
  938. ball[i].dy = -ball[i].dy
  939. end
  940. -- -4 to account for the ball's size
  941. if ball[i].y >= VIRTUAL_HEIGHT - 40 then
  942. soundtype = love.math.random(1, 5)
  943. sounds['wallhit']:setPitch(ballSpeed/250)
  944. sounds['wallhit']:play()
  945. ball[i].y = VIRTUAL_HEIGHT - 40
  946. ball[i].dy = -ball[i].dy
  947. end
  948. --love.window.setTitle('Trying to update the ball')
  949. if timeIsSlow then
  950. if ballSpeed > originalSpeed/3 then
  951. paddle_SPEED = 30
  952. ballSpeed = ballSpeed / (1+(dt*2))
  953. end
  954. player1nukescore = player1nukescore - (dt*50)
  955. if player1nukescore < 1 or ball[1].dx > 0 then
  956. timeIsSlow = false
  957. player1reverbav = false
  958. ballSpeed = originalSpeed
  959. sounds["time"]:stop()
  960. paddle_SPEED = originalPaddle
  961. end
  962. end
  963. if timeIsSlow2 then
  964. if ballSpeed > originalSpeed/3 then
  965. ballSpeed = ballSpeed / (1+(dt*2))
  966. end
  967. player2nukescore = player2nukescore - (dt*50)
  968. if player2nukescore < 1 or ball[1].dx < 0 then
  969. paddle_SPEED = 30
  970. timeIsSlow2 = false
  971. player2reverbav = false
  972. ballSpeed = originalSpeed
  973. sounds["time"]:stop()
  974. paddle_SPEED = originalPaddle
  975. end
  976. end
  977. ball[i]:update(dt)
  978. end
  979. end
  980. player1:update(dt)
  981. player2:update(dt)
  982. player3:update(dt)
  983. player4:update(dt)
  984. end
  985. function wallbreaker(x,y)
  986. if (gameState == 'editor') then
  987. for i, wall in ipairs(walls) do
  988. if math.abs(wall.wallx - x) < 10 and math.abs(wall.wally - y) < 10
  989. then
  990. table.remove(walls, i)
  991. end
  992. end
  993. end
  994. end
  995. function editor()
  996. if (gameState == 'editor')
  997. then
  998. local mx, my = love.mouse.getPosition()
  999. mx = mx * DIFFERENCE_X
  1000. my = my * DIFFERENCE_Y
  1001. if not blockinput then
  1002. love.graphics.setColor(1,0,0,1)
  1003. love.graphics.rectangle('fill',mx, my, 10, wall1width)
  1004. love.graphics.setColor(1,1,1,1)
  1005. end
  1006. if (love.mouse.isDown(2)) then
  1007. wallbreaker(mx, my)
  1008. end
  1009. if (love.mouse.isDown(3)) then
  1010. table.insert(walls, newWall(mx,my, 10, wall1width))
  1011. end
  1012. for i, wall in ipairs(walls) do
  1013. love.graphics.setColor(1,1,1,1)
  1014. love.graphics.rectangle("fill", wall.wallx, wall.wally, 10, wall.wallheight)
  1015. end
  1016. end
  1017. end
  1018. function hardmanager(diff)
  1019. selecting = 1
  1020. if (diff == 'easy')
  1021. then
  1022. INDIC[1] = '>'
  1023. AGAINST_AI = 1
  1024. AI_SPEED = ballSet/10
  1025. AI_STRIKEMOD = 100
  1026. AI_NUKEMOD = 1000
  1027. difficultyl = 200
  1028. selecting = 0
  1029. gameState = '1serve'
  1030. end
  1031. if (diff == 'normal')
  1032. then
  1033. INDIC[2] = '>'
  1034. AI_SPEED = ballSet/10
  1035. AI_LEVEL = 500
  1036. AI_NUKEMOD = 250
  1037. AI_STRIKEMOD = 60
  1038. AGAINST_AI = 1
  1039. difficultyl = 300
  1040. selecting = 0
  1041. gameState = '1serve'
  1042. end
  1043. if (diff == 'hard')
  1044. then
  1045. INDIC[3] = '>'
  1046. AI_SPEED = ballSpeed * 1.1 + 50
  1047. AI_SPEED = AI_SPEED / 10
  1048. AI_LEVEL = 700
  1049. AI_NUKEMOD = 200
  1050. AI_STRIKEMOD = 20
  1051. selecting = 0
  1052. difficultyl = 350
  1053. AGAINST_AI = 1
  1054. gameState = '1serve'
  1055. end
  1056. if (diff == 'practice') then
  1057. INDIC[3] = '>'
  1058. AI_SPEED = ballSpeed * 500 + 50
  1059. AI_SPEED = AI_SPEED / 10
  1060. AI_LEVEL = 700
  1061. AI_NUKEMOD = 9000000000
  1062. AI_STRIKEMOD = 90000000
  1063. selecting = 0
  1064. difficultyl = 350
  1065. AGAINST_AI = 1
  1066. gameState = '1serve'
  1067. end
  1068. end
  1069. function dangerChecker()
  1070. if (p1control.up == p1control.down) then danger = '1up' danger2 = '1down'
  1071. elseif (p1control.up == p1control.super) then danger = '1up' danger2 = '1special'
  1072. elseif (p1control.up == p1control.counter) then danger = '1up' danger2 = '1ct'
  1073. elseif (p1control.down == p1control.super) then danger = '1down' danger2 = '1special'
  1074. elseif (p1control.down == p1control.counter) then danger = '1ct' danger2 = '1down'
  1075. elseif (p1control.super == p1control.counter) then danger = '1special' danger2 = '1ct'
  1076. elseif (p2control.down == p2control.up) then danger = '2down' danger2 = '2up'
  1077. elseif (p2control.down == p2control.super) then danger = '2down' danger2 = '2special'
  1078. elseif (p2control.down == p2control.counter) then danger = '2down' danger2 = '2ct'
  1079. elseif (p2control.up == p2control.super) then danger = '2up' danger2 = '2special'
  1080. elseif (p2control.up == p2control.counter) then danger = '2ct' danger2 = '2up'
  1081. elseif (p2control.super == p2control.counter) then danger = '2special' danger2 = '2ct'
  1082. else
  1083. danger = "none"
  1084. danger2 = "none"
  1085. end
  1086. end
  1087. function love.keypressed(key)
  1088. if gameState == 'assign' then
  1089. if (req == 'p1up') then p1control.up = key
  1090. currentKey = key
  1091. --love.window.setTitle(key)
  1092. gameState = 'controlSettings'
  1093. end
  1094. if (req == 'p2up') then p2control.up = key
  1095. currentKey = key
  1096. --love.window.setTitle(key)
  1097. gameState = 'controlSettings'
  1098. end
  1099. if (req == 'p1down') then p1control.down = key
  1100. currentKey = key
  1101. --love.window.setTitle(key)
  1102. gameState = 'controlSettings'
  1103. end
  1104. if (req == 'p2down') then p2control.down = key
  1105. currentKey = key
  1106. -- love.window.setTitle(key)
  1107. gameState = 'controlSettings'
  1108. end
  1109. if (req == 'p1super') then p1control.super = key
  1110. currentKey = key
  1111. -- love.window.setTitle(key)
  1112. gameState = 'controlSettings'
  1113. end
  1114. if (req == 'p2super') then p2control.super = key
  1115. currentKey = key
  1116. -- love.window.setTitle(key)
  1117. gameState = 'controlSettings'
  1118. end
  1119. if (req == 'p1ct') then p1control.counter = key
  1120. currentKey = key
  1121. -- love.window.setTitle(key)
  1122. gameState = 'controlSettings'
  1123. end
  1124. if (req == 'p2ct') then p2control.counter = key
  1125. currentKey = key
  1126. --love.window.setTitle(key)
  1127. gameState = 'controlSettings'
  1128. end
  1129. end
  1130. if key == 'escape' then
  1131. TEXT = 'Escape Key'
  1132. love.event.quit()
  1133. elseif key == 'enter' or key == 'return' then
  1134. if gameState == 'start' then
  1135. resettinggenius()
  1136. gameState = 'menu'
  1137. hardmanager()
  1138. elseif (gameState == 'done') then
  1139. if (player1score > player2score) then
  1140. gameState = '2serve'
  1141. potentialnuke1 = 0
  1142. potentialnuke2 = 0
  1143. striken = 0
  1144. if (nuckemodactive == 0) then
  1145. areanuclear = 0
  1146. nuclearanimation = 3
  1147. end
  1148. potentialstrike1 = 0
  1149. potentialstrike2 = 0
  1150. player1nukescore = 0
  1151. player2nukescore = 0
  1152. else
  1153. gameState = '1serve'
  1154. resettinggenius()
  1155. for i = 1, maxBalls do
  1156. ball[i]:reset(i)
  1157. end
  1158. end
  1159. else
  1160. gameState = 'menu'
  1161. if (love.math.random(0, 10) == 1)
  1162. then
  1163. TEXT = "Nuclear Ching Chong"
  1164. else
  1165. TEXT = 'Nuclear Pong'
  1166. end
  1167. resettinggenius()
  1168. for i = 1, maxBalls do
  1169. ball[i]:reset(i)
  1170. end
  1171. end
  1172. end
  1173. end
  1174. function love.keyreleased(key)
  1175. currentKey = " "
  1176. end
  1177. function speedSetter(requesttype)
  1178. if (requesttype == 'ball') then
  1179. if (ballSet > 550) then
  1180. ballSet = 0
  1181. paddle_SPEED = 0
  1182. else
  1183. ballSet = ballSet + 50
  1184. paddle_SPEED = paddle_SPEED + 5
  1185. end
  1186. ballSpeed = ballSet
  1187. end
  1188. if (requesttype == 'snc') then
  1189. synctype = synctype + 1
  1190. if (synctype > 1) then
  1191. synctype = 0
  1192. end
  1193. if synctype == 0 then synctext = 'Independent' end
  1194. if synctype == 1 then synctext = 'Synchronised' end
  1195. end
  1196. if (requesttype == 'nuclearmod')
  1197. then
  1198. nuckemodactive = nuckemodactive + 1
  1199. if (nuckemodactive > 1) then
  1200. nuckemodactive = 0
  1201. end
  1202. if (nuckemodactive == 0)
  1203. then
  1204. areanuclear = 0
  1205. nuclearanimation = 3
  1206. ballSet = 200
  1207. TEXT = "Nuclear Pong"
  1208. synctype = 0
  1209. maxspeed = 700
  1210. synctext = 'Independent'
  1211. paddle_SPEED = ballSet/10
  1212. AI_SPEED = ballSet/10
  1213. end
  1214. if (nuckemodactive == 1)
  1215. then
  1216. areanuclear = 1
  1217. ballSet = 2000
  1218. maxspeed = 2000
  1219. paddle_SPEED = ballSet/10
  1220. AI_SPEED = ballSet/10
  1221. synctext = "death is imminent"
  1222. end
  1223. ballSpeed = ballSet
  1224. end
  1225. if (requesttype == 'practice') then
  1226. if (ballSpeed > 999) then
  1227. ballSpeed = 200
  1228. ballSet = 200
  1229. end
  1230. if (ballSpeed > 799) then
  1231. prtext = 'Insane'
  1232. maxBalls = 5
  1233. elseif ballSpeed > 599 then
  1234. prtext = 'Hard'
  1235. maxBalls = 4
  1236. elseif ballSpeed > 399 then
  1237. prtext = 'Normal'
  1238. maxBalls = 3
  1239. elseif ballSpeed > 199 then
  1240. prtext = 'Easy'
  1241. maxBalls = 3
  1242. end
  1243. ballSpeed = ballSpeed + 200
  1244. ballSet = ballSet + 200
  1245. end
  1246. if (requesttype == 'reset')
  1247. then
  1248. ballSpeed = 200
  1249. ballSet = 200
  1250. synctype = 0
  1251. prtext = 'Easy'
  1252. maxBalls = 1
  1253. end
  1254. if (requesttype == 'pc') then
  1255. if (playerCount == 2) then
  1256. playerCount = 1
  1257. playertext = '1v1'
  1258. elseif (playerCount == 1) then
  1259. playerCount = playerCount + 1
  1260. player3.x = player1.x + VIRTUAL_WIDTH / 2
  1261. player3.y = player3.y
  1262. playertext = '2v2'
  1263. end
  1264. end
  1265. if (requesttype == 'ballz') then
  1266. if (maxBalls > 1) then
  1267. maxBalls = 1
  1268. --love.window.setTitle("more than 4")
  1269. else
  1270. maxBalls = maxBalls + 1
  1271. end
  1272. end
  1273. if requesttype == 'ptw' then
  1274. if ptw == 10 then
  1275. ptw = 1
  1276. else
  1277. ptw = ptw + 1
  1278. end
  1279. end
  1280. end
  1281. function gameModeChanger()
  1282. if (gameState == 'gameMode') then
  1283. local button_width = VIRTUAL_WIDTH * (1/3)
  1284. local BUTTON_HEIGHT = 50
  1285. local margin = 20
  1286. local hot = false
  1287. local cursor_y = 0
  1288. local total_height = (BUTTON_HEIGHT + margin) * #buttons
  1289. for i, button in ipairs(modeSelectorButtons) do
  1290. button.last = button.now
  1291. local bx = (VIRTUAL_WIDTH*0.5) - (button_width * 0.5)
  1292. local by = (VIRTUAL_HEIGHT * 0.5) - (total_height * 0.5) + cursor_y
  1293. local color = {255, 255, 255, 255}
  1294. local mx, my = love.mouse.getPosition()
  1295. mx = mx * DIFFERENCE_X
  1296. my = my * DIFFERENCE_Y
  1297. hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
  1298. if (hot == i) then
  1299. color = {10, 10, 0, 255}
  1300. end
  1301. button.now = love.mouse.isDown(1)
  1302. if button.now and not button.last and hot == i then
  1303. love.graphics.setColor(0,0,0,1)
  1304. love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
  1305. sounds['wallhit']:play()
  1306. button.fn()
  1307. end
  1308. love.graphics.setColor(unpack(color))
  1309. love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
  1310. love.graphics.setColor(0, 0, 0, 255)
  1311. local textW = smallfont:getWidth(button.text)
  1312. local textH = smallfont:getHeight(button.text)
  1313. love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1314. love.graphics.setColor(255, 255, 255, 255)
  1315. cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
  1316. end
  1317. end
  1318. if (gameState == 'multiMode')
  1319. then
  1320. local button_width = VIRTUAL_WIDTH * (1/3)
  1321. local BUTTON_HEIGHT = 50
  1322. local margin = 20
  1323. local hot = false
  1324. local cursor_y = 0
  1325. local total_height = (BUTTON_HEIGHT + margin) * #buttons
  1326. for i, button in ipairs(playerCountButtons) do
  1327. button.last = button.now
  1328. local bx = (VIRTUAL_WIDTH*0.5) - (button_width * 0.5)
  1329. local by = (VIRTUAL_HEIGHT * 0.3) - (total_height * 0.5) + cursor_y
  1330. if (button.text == 'Play') then
  1331. by = by + by/1.8
  1332. end
  1333. local color = {255, 255, 255, 255}
  1334. local mx, my = love.mouse.getPosition()
  1335. mx = mx * DIFFERENCE_X
  1336. my = my * DIFFERENCE_Y
  1337. hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
  1338. if (hot == i) then
  1339. if (button.text == 'Play') then color = {0/255, 255/255, 0/255, 255} else
  1340. color = {10, 10, 0, 255}
  1341. end
  1342. end
  1343. button.now = love.mouse.isDown(1)
  1344. if button.now and not button.last and hot == i then
  1345. love.graphics.setColor(0,0,0,1)
  1346. love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
  1347. sounds['wallhit']:play()
  1348. if button.text == "Ball Speed: " and nuckemodactive == 1 then
  1349. else
  1350. button.fn()
  1351. end
  1352. end
  1353. love.graphics.setColor(unpack(color))
  1354. love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
  1355. love.graphics.setColor(0, 0, 0, 255)
  1356. local textW = smallfont:getWidth(button.text)
  1357. local textH = smallfont:getHeight(button.text)
  1358. if (button.text == '1v1') then love.graphics.print(playertext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1359. elseif button.text == 'snc' then
  1360. if (nuckemodactive == 1) then
  1361. love.graphics.setColor(1,0,0,1)
  1362. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1363. love.graphics.setColor(1,1,1,1)
  1364. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1365. love.graphics.setColor(0,0,0,1)
  1366. else
  1367. --
  1368. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.45 - textW*0.5, by+textH*0.5)
  1369. end
  1370. elseif (button.text == 'ballCount') then love.graphics.print("Ball Count: " .. maxBalls, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1371. elseif (button.text == "Ball Speed: ") then
  1372. if (nuckemodactive == 1) then
  1373. love.graphics.setColor(1,0,0,1)
  1374. love.graphics.print("shaitan machina", smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1375. love.graphics.setColor(1,1,1,1)
  1376. love.graphics.print("shaitan machina", smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1377. love.graphics.setColor(0,0,0,1)
  1378. else
  1379. love.graphics.print(button.text .. ballSet, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1380. end
  1381. elseif button.text == 'ptw' then love.graphics.print("Points to Win: " .. ptw, smallfont,VIRTUAL_WIDTH*0.5 - textW * 1.5, by+textH*0.5)
  1382. else
  1383. love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, by+textH*0.5)
  1384. end
  1385. love.graphics.setColor(255, 255, 255, 255)
  1386. cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
  1387. end
  1388. end
  1389. end
  1390. function love.draw()
  1391. simpleScale.set()
  1392. -- resolutionChanger()
  1393. --love.graphics.scale( 1.5, 1.5 )
  1394. -- love.graphics.translate( (WINDOW_WIDTH*1.5 - WINDOW_WIDTH), WINDOW_HEIGHT*1.5 - WINDOW_HEIGHT )
  1395. -- push:apply('start')
  1396. --resolutionButtons()
  1397. if gameState == 'nuclearExplosion' then
  1398. love.graphics.setColor(1,1,1,1)
  1399. love.graphics.circle("fill", ball[1].x, ball[1].y , explosionRange*100, 100)
  1400. player1.RED, player1.GREEN, player1.BLUE, player2.RED, player2.GREEN, player2.BLUE = nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,nuclearanimation/3
  1401. for i = 1, maxBalls do
  1402. love.graphics.setColor(nuclearanimation/3,nuclearanimation/3,nuclearanimation/3,1)
  1403. ball[i]:render('controlled')
  1404. end
  1405. player1:render()
  1406. player2:render()
  1407. elseif gameState == 'animation' then
  1408. callAnimator()
  1409. else
  1410. mapChanger()
  1411. if t < shakeDuration then
  1412. --love.window.setTitle("lamo")
  1413. local dx = love.math.random(-shakeMagnitude, shakeMagnitude)
  1414. local dy = love.math.random(-shakeMagnitude, shakeMagnitude)
  1415. love.graphics.translate(dx, dy)
  1416. end
  1417. if (gameState == 'menu') then
  1418. updateTEXT = '0.7 Chalkboard Update'
  1419. end
  1420. serveBot()
  1421. hardmanager()
  1422. if (areanuclear == 1) then
  1423. love.graphics.setShader(shader)
  1424. love.graphics.clear(1,1,1,1)
  1425. else
  1426. love.graphics.setShader()
  1427. love.graphics.clear(40/255, 40/255, 40/255, 1) --BACKGROUND COLOR
  1428. end
  1429. if (gameMode == 'practice') then
  1430. love.graphics.rectangle('fill', VIRTUAL_WIDTH, 0, 10, VIRTUAL_HEIGHT)
  1431. end
  1432. if (MAP_TYPE == 1) then
  1433. love.graphics.setColor(1, 0, 0.20, 1)
  1434. love.graphics.rectangle('fill', VIRTUAL_WIDTH *0.5, 0, 10, VIRTUAL_HEIGHT * 0.3)
  1435. love.graphics.rectangle('fill', VIRTUAL_WIDTH *0.5, VIRTUAL_HEIGHT * 0.7, 10, VIRTUAL_HEIGHT * 0.3)
  1436. love.graphics.setColor(1, 1, 1, 1)
  1437. end
  1438. love.graphics.setFont(scorefont)
  1439. if gameState == 'play' or gameState == '1serve' or gameState == '2serve' then
  1440. love.graphics.setFont(smallfont)
  1441. end
  1442. love.graphics.printf(TEXT,0,20,VIRTUAL_WIDTH,'center')
  1443. love.graphics.setFont(smallfont)
  1444. love.graphics.printf(updateTEXT,0,VIRTUAL_HEIGHT * 0.95,VIRTUAL_WIDTH,'left')
  1445. love.graphics.setFont(scorefont)
  1446. love.graphics.print(tostring(math.floor(player1score)), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 12)
  1447. if (gameMode ~= 'practice') then
  1448. love.graphics.print(tostring(math.floor(player2score)), VIRTUAL_WIDTH / 2 + 400, VIRTUAL_HEIGHT / 12)
  1449. end
  1450. love.graphics.setFont(smallfont)
  1451. if (potentialstrike1 == 1 and potentialnuke1 == 0 and player1reverbav == 0) then
  1452. if (player1striken == 0) then
  1453. love.graphics.print(tostring(math.floor(player1nukescore) .. '['..p1control.super..']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
  1454. else
  1455. love.graphics.print(tostring('READY'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
  1456. end
  1457. elseif (player1reverbav == 1 and potentialnuke1 == 0) then
  1458. love.graphics.print(tostring(math.floor(player1nukescore) ..'[' ..p1control.super .. ']' .. " ["..p1control.counter..']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
  1459. elseif (potentialnuke1 == 1) then
  1460. love.graphics.setColor(255, 0, 0, 255)
  1461. love.graphics.print(tostring(math.floor(player1nukescore) .. '[' .. p1control.super .. ']' .. " ["..p1control.counter .. ']'), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
  1462. love.graphics.setColor(255, 255, 255, 255)
  1463. else
  1464. love.graphics.print(tostring(math.floor(player1nukescore)), VIRTUAL_WIDTH / 2 - 500, VIRTUAL_HEIGHT / 60)
  1465. end
  1466. if (potentialstrike2 == 1 and player2reverbav == 0) then
  1467. if (player2striken == 0 and gameMode ~= 'practice') then
  1468. love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
  1469. elseif (gameMode ~= 'practice') then
  1470. love.graphics.print(tostring('READY'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
  1471. end
  1472. elseif (potentialnuke2 == 1 and gameMode ~= 'practice') then
  1473. love.graphics.setColor(255, 0, 0, 255)
  1474. love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
  1475. love.graphics.setColor(255, 255, 255, 255)
  1476. elseif (player2reverbav == 1 and potentialnuke2 == 0) then
  1477. love.graphics.print(tostring(math.floor(player2nukescore) .. '['..p2control.super .. "] [" .. p2control.counter..']'), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
  1478. elseif (gameMode ~= 'practice') then
  1479. love.graphics.print(tostring(math.floor(player2nukescore)), VIRTUAL_WIDTH / 2 + 430, VIRTUAL_HEIGHT / 60)
  1480. end
  1481. if (MAP_TYPE == 2) then
  1482. for i, wall in ipairs(walls) do
  1483. love.graphics.setColor(1,1,1,1)
  1484. love.graphics.rectangle("fill", wall.wallx, wall.wally, 10, wall.wallheight)
  1485. end
  1486. end
  1487. if gameState ~= 'assign' then
  1488. player1:render()
  1489. player3:render()
  1490. if gameMode ~= 'practice' then
  1491. player2:render()
  1492. player4:render()
  1493. end
  1494. for i = 1, maxBalls do
  1495. if areanuclear == 1 then
  1496. ball[i]:render('black')
  1497. --love.window.setTitle('rendering black')
  1498. else
  1499. ball[i]:render(' ')
  1500. --love.window.setTitle('rendering white')
  1501. end
  1502. end
  1503. if gameState == 'windowsettings' then
  1504. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, settings, sounds, 'right')
  1505. love.keyboard.mouseisReleased = false
  1506. end
  1507. if gameState == 'editor' then
  1508. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, editorpicks, sounds, 'right')
  1509. love.keyboard.mouseisReleased = false
  1510. end
  1511. if gameState == 'speedSettings' then
  1512. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, speedParameters, sounds, 'middle')
  1513. love.keyboard.mouseisReleased = false
  1514. end
  1515. if gameState == 'controlSettings' then
  1516. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, controlSettings, sounds, 'control')
  1517. love.keyboard.mouseisReleased = false
  1518. end
  1519. if gameState == 'gameMode' then
  1520. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, modeSelectorButtons, sounds, 'middle')
  1521. love.keyboard.mouseisReleased = false
  1522. end
  1523. if gameState == 'menu' then
  1524. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, 'middle')
  1525. love.keyboard.mouseisReleased = false
  1526. end
  1527. if gameState == 'difficulty' then
  1528. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, difbuttons, sounds, 'middle')
  1529. love.keyboard.mouseisReleased = false
  1530. end
  1531. if gameState == 'multiMode' then
  1532. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, playerCountButtons, sounds, 'playercount')
  1533. love.keyboard.mouseisReleased = false
  1534. end
  1535. if gameState == 'prdiff' then
  1536. mymenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, pracdiff, sounds, 'playercount')
  1537. love.keyboard.mouseisReleased = false
  1538. end
  1539. end
  1540. editor()
  1541. if (gameState == 'start') then
  1542. love.graphics.push()
  1543. love.graphics.translate(
  1544. VIRTUAL_WIDTH * 0.4,
  1545. VIRTUAL_HEIGHT * 0.5
  1546. )
  1547. love.graphics.rotate(rotation)
  1548. love.graphics.setFont(smallfont)
  1549. love.graphics.print("Press Enter to Start", WINDOW_WIDTH / -10 , VIRTUAL_HEIGHT / 8)
  1550. love.graphics.setColor(255,255,255,255)
  1551. love.graphics.pop()
  1552. end
  1553. end
  1554. if gameState == 'assign' then
  1555. controlChanger()
  1556. end
  1557. simpleScale.unSet()
  1558. end
  1559. -- push:apply('end')
  1560. function controllerSer()
  1561. for i = 1, maxBalls do
  1562. if (ball[i].dy == 0) then
  1563. hitNum[i] = hitNum[i] +1
  1564. --love.window.setTitle(hitNum[i])
  1565. if hitNum[i] >= 10 then
  1566. ball[i].dy = 1
  1567. hitNum[i] = 0
  1568. end
  1569. else
  1570. hitNum[i] = 0
  1571. end
  1572. end
  1573. end
  1574. function palleteController()
  1575. if (areanuclear == 0) then player1.RED = 1 player1.GREEN = 1 player1.BLUE = 1 end
  1576. if (areanuclear == 0) then player2.RED = 1 player2.GREEN = 1 player2.BLUE = 1 end
  1577. if (areanuclear == 1) then player1.RED = 0 player1.GREEN = 0 player1.BLUE = 0 end
  1578. if (areanuclear == 1) then player2.RED = 0 player2.GREEN = 0 player2.BLUE = 0 end
  1579. end
  1580. function love.wheelmoved(x, y)
  1581. if (y < 0 and wall1width > 0) then
  1582. wall1width = wall1width - 5
  1583. elseif y > 0 and wall1width < 900 then wall1width = wall1width + 5
  1584. end
  1585. end
  1586. function serveBot()
  1587. if (gameState == '1serve') then
  1588. updateTEXT = ''
  1589. if (gameMode ~= 'practice') then
  1590. TEXT = 'PLAYER 1, serve!(q)'
  1591. end
  1592. if (love.keyboard.isDown('q') or gameMode == 'practice') then
  1593. TEXT = 'Lets Begin!'
  1594. ball_DIR = 1
  1595. for i = 1, maxBalls do
  1596. ball[i]:reset(i)
  1597. end
  1598. --love.window.setTitle("An atttttttt")
  1599. gameState = 'play'
  1600. end
  1601. end
  1602. if (gameState == '2serve') then
  1603. TEXT = 'PLAYER 2, serve!(p)'
  1604. if (AGAINST_AI == 1) then
  1605. TEXT = ''
  1606. ball_DIR = -1
  1607. for i = 1, maxBalls do
  1608. ball[i]:reset(i)
  1609. end
  1610. --love.window.setTitle("An atttttttt")
  1611. gameState = 'play'
  1612. end
  1613. if (love.keyboard.isDown('p') and AGAINST_AI == 0) then
  1614. TEXT = 'Lets Begin'
  1615. ball_DIR = -1
  1616. for i = 1, maxBalls do
  1617. ball[i]:reset(i)
  1618. end
  1619. --love.window.setTitle("An atttttttt")
  1620. gameState = 'play'
  1621. end
  1622. end
  1623. end
  1624. function mapChanger()
  1625. for i = 1, maxBalls do
  1626. if (gameState == 'editor') then MAP_TYPE = 2 end
  1627. if (MAP_TYPE > 2) then
  1628. MAP_TYPE = 0
  1629. end
  1630. if (gameMode == 'practice') then
  1631. MAP_TYPE = 0
  1632. if ball[i].x > VIRTUAL_WIDTH * 0.99 then
  1633. soundtype = love.math.random(1, 5)
  1634. sounds['wallhit']:setPitch(ballSpeed/250)
  1635. sounds['wallhit']:play()
  1636. if (ball[i].dx > 0)
  1637. then ball[i].x = ball[i].x - 20
  1638. else ball[i].x = ball[i].x + 20
  1639. end
  1640. ball[i].dx = -ball[i].dx
  1641. end
  1642. end
  1643. if (MAP_TYPE == 1)
  1644. then
  1645. 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
  1646. soundtype = love.math.random(1, 5)
  1647. sounds['wallhit']:setPitch(ballSpeed/250)
  1648. sounds['wallhit']:play()
  1649. if (ball[i].dx > 0)
  1650. then ball[i].x = ball[i].x - 20
  1651. else ball[i].x = ball[i].x + 20
  1652. end
  1653. ball[i].dx = -ball[i].dx
  1654. end
  1655. 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
  1656. soundtype = love.math.random(1, 5)
  1657. sounds['wallhit']:setPitch(ballSpeed/250)
  1658. sounds['wallhit']:play()
  1659. if (ball[i].dx > 0)
  1660. then ball[i].x = ball[i].x - 20
  1661. else ball[i].x = ball[i].x + 20
  1662. end
  1663. ball[i].dx = -ball[i].dx
  1664. end
  1665. end
  1666. if (MAP_TYPE == 2) then
  1667. for i, wall in ipairs(walls) do
  1668. 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
  1669. controllerSer()
  1670. soundtype = love.math.random(1, 5)
  1671. sounds['wallhit']:setPitch(ballSpeed/250)
  1672. sounds['wallhit']:play()
  1673. if (ball[1].dx > 0)
  1674. then ball[1].x = ball[1].x - 1
  1675. else ball[1].x = ball[1].x + 1
  1676. end
  1677. ball[1].dx = -ball[1].dx
  1678. 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
  1679. controllerSer()
  1680. soundtype = love.math.random(1, 5)
  1681. sounds['wallhit']:setPitch(ballSpeed/250)
  1682. sounds['wallhit']:play()
  1683. if (ball[1].dy > 0)
  1684. then ball[1].y = ball[1].y - 1
  1685. else ball[1].y = ball[1].y + 1
  1686. end
  1687. ball[1].dy = -ball[1].dy
  1688. end
  1689. end
  1690. end
  1691. end
  1692. end
  1693. function resolutionChanger()
  1694. if (RESOLUTION_SET > 1) then
  1695. RESOLUTION_SET = 0
  1696. end
  1697. if (RESOLUTION_SET == 0 ) then
  1698. if (isFullscreen == 1) then
  1699. DIFFERENCE_X = 1
  1700. DIFFERENCE_Y = 1
  1701. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT,{fullscreen = false})
  1702. isFullscreen = 0
  1703. end
  1704. end
  1705. if (RESOLUTION_SET == 1) then
  1706. if (isFullscreen == 0) then
  1707. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true})
  1708. local newWidth = love.graphics.getWidth()
  1709. local newHeight = love.graphics.getHeight()
  1710. DIFFERENCE_X = VIRTUAL_WIDTH / newWidth
  1711. DIFFERENCE_Y = VIRTUAL_HEIGHT / newHeight
  1712. isFullscreen = 1
  1713. end
  1714. end
  1715. end
  1716. function resettinggenius()
  1717. maxBalls = 1
  1718. for i =1, maxBalls do
  1719. ball[i]:reset(i)
  1720. end
  1721. paddle_SPEED = 20
  1722. nuclearanimation = 3
  1723. timeIsSlow =false
  1724. timeIsSlow2 = false
  1725. originalSpeed = 200
  1726. gameState = 'menu'
  1727. gameMode = 'notpracticd'
  1728. ballSet = 200
  1729. ballSpeed = ballSet
  1730. player2.GREEN = 255
  1731. player2.BLUE = 255
  1732. player1.GREEN = 255
  1733. player1.BLUE = 255
  1734. player1score = 0
  1735. player2score = 0
  1736. potentialnuke1 = 0
  1737. potentialnuke2 = 0
  1738. striken = 0
  1739. areanuclear = 0
  1740. potentialstrike1 = 0
  1741. potentialstrike2 = 0
  1742. player1nukescore = 0
  1743. player2nukescore = 0
  1744. player1reverbav = 0
  1745. player2reverbav = 0
  1746. selecting = 0
  1747. AGAINST_AI = 0
  1748. end
  1749. function animator(dt)
  1750. if (gameState == 'animation') then
  1751. time_1 = time_1 + dt
  1752. light = 255 - time_1 * 85
  1753. if (light < 0) then
  1754. time_1 = 0
  1755. light = 0
  1756. gameState = 'start'
  1757. end
  1758. end
  1759. end
  1760. function callAnimator()
  1761. love.graphics.setColor(255,255,255,light/255)
  1762. love.graphics.draw(image,0,0)
  1763. end
  1764. function love.mousereleased(x, y, button)
  1765. love.keyboard.mouseisReleased = true
  1766. if (gameState == 'editor') then
  1767. if (#walls < 1000 and button == 1 and blockinput ~= true) then
  1768. table.insert(walls, newWall(x*DIFFERENCE_X,y*DIFFERENCE_Y, 10, wall1width))
  1769. end
  1770. end
  1771. end