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.

1558 lines
42 KiB

  1. --CALLING OTHER LUA FILES
  2. require "src/dependencies"
  3. io.stdout:setvbuf("no")
  4. --CANCELLED ATTEMPETED SHADING (NOT WORKING)
  5. local shader_code =
  6. [[
  7. vec4 effect(vec4 color, Image image, vec2 uvs, vec2 screen_coords) {
  8. vec4 pixel = Texel(image,uvs);
  9. return pixel * color;
  10. }
  11. ]]
  12. debug = true
  13. --GLOBAL VARIABLES
  14. gameMode = "normal"
  15. ts = 0
  16. globalState = "menu"
  17. timeIsSlow = false
  18. timeIsSlow2 = false
  19. originalSpeed = 200
  20. explosionRange = 0
  21. blockinput = false
  22. wall1width = 30
  23. nuclearanimation = 3
  24. easternum = 0
  25. ball_DIR = 0
  26. updaterate = 0.03
  27. RED = 255
  28. hitNum = {}
  29. hitNum[1] = 0
  30. hitNum[2] = 0
  31. hitNum[3] = 0
  32. confirmation = "N"
  33. hitNum[4] = 0
  34. p1bonus = 0
  35. p2bonus = 0
  36. hitNum[5] = 0
  37. hitNum[6] = 0
  38. GREEN = 255
  39. IP = '45.76.95.31'
  40. BLUE = 255
  41. updateTEXT = "Chalkboard Update"
  42. maxBalls = 1
  43. playerCount = 1
  44. player1reverbav = 0
  45. playertext = "1v1"
  46. player2reverbav = 0
  47. elapsed = 0
  48. rotation = 0
  49. TEXT = "Nuclear Pong"
  50. currentKey = " "
  51. ptw = 10
  52. --CHECKING IF CONTROLS ARE TAKEN
  53. danger = "none"
  54. danger2 = "none"
  55. nuckemodactive = 0
  56. maxspeed = 700
  57. DIFFERENCE_X = 1
  58. DIFFERENCE_Y = 1
  59. paddle_SPEED = 20
  60. textamount = 15
  61. AI_STRIKEMOD = 1000
  62. resolutionWin = 0
  63. AGAINST_AI = 0
  64. RESOLUTION_SET = 0
  65. AI_NUKEMOD = 1000
  66. animstart = true
  67. AI_SPEED = 30
  68. craz = 0
  69. AI_LEVEL = 500
  70. isFullscreen = 0
  71. prtext = "Easy"
  72. lastSentKey = "c"
  73. MAP_TYPE = 0
  74. lastSentKeyClient = "c"
  75. difficultyl = 300
  76. req = "pp"
  77. ballSet = 200
  78. p1control = {up = "a", down = "z", super = "s", counter = "x"}
  79. p2control = {up = ";", down = ".", super = "l", counter = ","}
  80. synctext = "Independent"
  81. synctype = 0
  82. function newButton(text, fn)
  83. return {
  84. text = text,
  85. fn = fn,
  86. now = false,
  87. last = false
  88. }
  89. end
  90. function love.keyboard.mouseWasReleased()
  91. return love.keyboard.mouseisReleased
  92. end
  93. function autoSave(dt)
  94. autoTimer = autoTimer + dt
  95. end
  96. function balancer()
  97. if (player2score == 9 or player1score == 9) then
  98. shakeDuration = 5
  99. if debug then
  100. --print("Shaking set to match almost over")
  101. end
  102. end
  103. if (player1score < player2score) then
  104. p1bonus = (player2score - player1score) * 5
  105. else
  106. p1bonus = 0
  107. end
  108. if (player2score < player1score) then
  109. p2bonus = (player1score - player2score) * 5
  110. else
  111. p2bonus = 0
  112. end
  113. end
  114. function newWall(wallx, wally, wallwidth, wallheight)
  115. return {
  116. wallx = wallx,
  117. wally = wally,
  118. walwidth = wallwidth,
  119. wallheight = wallheight
  120. }
  121. end
  122. speedParameters = {}
  123. buttons = {}
  124. IPselect = {}
  125. difbuttons = {}
  126. settings = {}
  127. walls = {}
  128. editorpicks = {}
  129. controlSettings = {}
  130. modeSelectorButtons = {}
  131. pracdiff = {}
  132. playerCountButtons = {}
  133. function controlChanger()
  134. if (gameState == "assign") then
  135. love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255)
  136. love.graphics.printf("SELECT BUTTON", 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
  137. end
  138. end
  139. function love.load()
  140. love.keyboard.setKeyRepeat(true)
  141. simpleScale.setWindow(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT)
  142. configfile = io.open("config.lua", "r")
  143. configsave = io.open("config.lua", "w")
  144. shader = love.graphics.newShader(shader_code)
  145. time_1 = 0
  146. --print("Debug active")
  147. --load
  148. testwalls = love.filesystem.load("save.lua")()
  149. if testwalls ~= nil then
  150. walls = love.filesystem.load("save.lua")()
  151. end
  152. light = 0
  153. image = love.graphics.newImage("Madi.png")
  154. table.insert(
  155. editorpicks,
  156. newButton(
  157. "C",
  158. function()
  159. for k in pairs(walls) do
  160. walls[k] = nil
  161. end
  162. end
  163. )
  164. )
  165. table.insert(
  166. editorpicks,
  167. newButton(
  168. "S",
  169. function()
  170. love.filesystem.write("save.lua", serialize(walls))
  171. end
  172. )
  173. )
  174. table.insert(
  175. editorpicks,
  176. newButton(
  177. "L",
  178. function()
  179. walls = love.filesystem.load("save.lua")()
  180. end
  181. )
  182. )
  183. table.insert(
  184. buttons,
  185. newButton(
  186. "Singleplayer",
  187. function()
  188. gameState = "gameMode"
  189. end
  190. )
  191. )
  192. table.insert(
  193. buttons,
  194. newButton(
  195. "Online",
  196. function()
  197. gameState = "chooseIP"
  198. end
  199. )
  200. )
  201. table.insert(
  202. IPselect,
  203. newButton(
  204. "Host",
  205. function()
  206. globalState = "nettest"
  207. AGAINST_AI = 0
  208. gameState = "1serve"
  209. end
  210. )
  211. )
  212. table.insert(
  213. IPselect,
  214. newButton(
  215. "Guest",
  216. function()
  217. globalState = "clienttest"
  218. AGAINST_AI = 0
  219. gameState = "1serve"
  220. end
  221. )
  222. )
  223. table.insert(
  224. buttons,
  225. newButton(
  226. "Multiplayer",
  227. function()
  228. gameState = "multiMode"
  229. end
  230. )
  231. )
  232. table.insert(
  233. buttons,
  234. newButton(
  235. "Settings",
  236. function()
  237. AGAINST_AI = 0
  238. gameState = "windowsettings"
  239. end
  240. )
  241. )
  242. table.insert(
  243. buttons,
  244. newButton(
  245. "Exit",
  246. function()
  247. love.event.quit(0)
  248. end
  249. )
  250. )
  251. table.insert(
  252. difbuttons,
  253. newButton(
  254. "Easy",
  255. function()
  256. hardmanager("easy")
  257. end
  258. )
  259. )
  260. table.insert(
  261. difbuttons,
  262. newButton(
  263. "Normal",
  264. function()
  265. hardmanager("normal")
  266. end
  267. )
  268. )
  269. table.insert(
  270. difbuttons,
  271. newButton(
  272. "Hard",
  273. function()
  274. hardmanager("hard")
  275. end
  276. )
  277. )
  278. table.insert(
  279. difbuttons,
  280. newButton(
  281. "Smart",
  282. function()
  283. hardmanager("smart")
  284. end
  285. )
  286. )
  287. table.insert(
  288. settings,
  289. newButton(
  290. "Change Map",
  291. function()
  292. MAP_TYPE = MAP_TYPE + 1
  293. end
  294. )
  295. )
  296. table.insert(
  297. settings,
  298. newButton(
  299. "Toggle Fullscreen",
  300. function()
  301. myscreen:toggle(VIRTUAL_HEIGHT, VIRTUAL_WIDTH)
  302. DIFFERENCE_X = myscreen.c
  303. DIFFERENCE_Y = myscreen.d
  304. end
  305. )
  306. )
  307. table.insert(
  308. settings,
  309. newButton(
  310. "Editor",
  311. function()
  312. gameState = "editor"
  313. end
  314. )
  315. )
  316. table.insert(
  317. settings,
  318. newButton(
  319. "Speed Settings",
  320. function()
  321. gameState = "speedSettings"
  322. end
  323. )
  324. )
  325. table.insert(
  326. settings,
  327. newButton(
  328. "Control Settings",
  329. function()
  330. gameState = "controlSettings"
  331. end
  332. )
  333. )
  334. table.insert(
  335. settings,
  336. newButton(
  337. "Back to Menu",
  338. function()
  339. gameState = "menu"
  340. end
  341. )
  342. )
  343. table.insert(
  344. speedParameters,
  345. newButton(
  346. "Back to Menu",
  347. function()
  348. gameState = "windowsettings"
  349. end
  350. )
  351. )
  352. --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end))
  353. table.insert(
  354. playerCountButtons,
  355. newButton(
  356. "Ball Speed: ",
  357. function()
  358. speedSetter("ball")
  359. end
  360. )
  361. )
  362. --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end))
  363. table.insert(
  364. playerCountButtons,
  365. newButton(
  366. "snc",
  367. function()
  368. speedSetter("snc")
  369. end
  370. )
  371. )
  372. table.insert(
  373. speedParameters,
  374. newButton(
  375. "NUCLEAR MODE",
  376. function()
  377. speedSetter("nuclearmod")
  378. end
  379. )
  380. )
  381. table.insert(
  382. controlSettings,
  383. newButton(
  384. "1up",
  385. function()
  386. gameState = "assign"
  387. req = "p1up"
  388. end
  389. )
  390. )
  391. table.insert(
  392. controlSettings,
  393. newButton(
  394. "1down",
  395. function()
  396. gameState = "assign"
  397. req = "p1down"
  398. end
  399. )
  400. )
  401. table.insert(
  402. controlSettings,
  403. newButton(
  404. "1special",
  405. function()
  406. gameState = "assign"
  407. req = "p1super"
  408. end
  409. )
  410. )
  411. table.insert(
  412. controlSettings,
  413. newButton(
  414. "1ct",
  415. function()
  416. gameState = "assign"
  417. req = "p1ct"
  418. end
  419. )
  420. )
  421. table.insert(
  422. controlSettings,
  423. newButton(
  424. "2up",
  425. function()
  426. gameState = "assign"
  427. req = "p2up"
  428. end
  429. )
  430. )
  431. table.insert(
  432. controlSettings,
  433. newButton(
  434. "2down",
  435. function()
  436. gameState = "assign"
  437. req = "p2down"
  438. end
  439. )
  440. )
  441. table.insert(
  442. controlSettings,
  443. newButton(
  444. "2special",
  445. function()
  446. gameState = "assign"
  447. req = "p2super"
  448. end
  449. )
  450. )
  451. table.insert(
  452. controlSettings,
  453. newButton(
  454. "2ct",
  455. function()
  456. gameState = "assign"
  457. req = "p2ct"
  458. end
  459. )
  460. )
  461. table.insert(
  462. controlSettings,
  463. newButton(
  464. "Default",
  465. function()
  466. p1control = {up = "a", down = "z", super = "s", counter = "x"}
  467. p2control = {up = ";", down = ".", super = "l", counter = ","}
  468. end
  469. )
  470. )
  471. table.insert(
  472. controlSettings,
  473. newButton(
  474. "Return",
  475. function()
  476. gameState = "windowsettings"
  477. end
  478. )
  479. )
  480. table.insert(
  481. modeSelectorButtons,
  482. newButton(
  483. "Nuclear Pong",
  484. function()
  485. gameState = "difficulty"
  486. end
  487. )
  488. )
  489. table.insert(
  490. modeSelectorButtons,
  491. newButton(
  492. "Main Menu",
  493. function()
  494. gameState = "menu"
  495. end
  496. )
  497. )
  498. table.insert(
  499. pracdiff,
  500. newButton(
  501. "Silverblade",
  502. function()
  503. speedSetter("practice")
  504. end
  505. )
  506. )
  507. table.insert(
  508. pracdiff,
  509. newButton(
  510. "Return",
  511. function()
  512. speedSetter("reset")
  513. gameState = "gameMode"
  514. end
  515. )
  516. )
  517. table.insert(
  518. pracdiff,
  519. newButton(
  520. "Go!",
  521. function()
  522. gameMode = "practice"
  523. hardmanager("practice")
  524. end
  525. )
  526. )
  527. --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end))
  528. table.insert(
  529. playerCountButtons,
  530. newButton(
  531. "ballCount",
  532. function()
  533. speedSetter("ballz")
  534. end
  535. )
  536. )
  537. table.insert(
  538. difbuttons,
  539. newButton(
  540. "ballCount",
  541. function()
  542. speedSetter("ballz")
  543. end
  544. )
  545. )
  546. table.insert(
  547. playerCountButtons,
  548. newButton(
  549. "Return",
  550. function()
  551. speedSetter("reset")
  552. gameState = "menu"
  553. end
  554. )
  555. )
  556. table.insert(
  557. playerCountButtons,
  558. newButton(
  559. "ptw",
  560. function()
  561. speedSetter("ptw")
  562. end
  563. )
  564. )
  565. table.insert(
  566. playerCountButtons,
  567. newButton(
  568. "Play",
  569. function()
  570. AGAINST_AI = 0
  571. gameState = "1serve"
  572. globalState = "base"
  573. end
  574. )
  575. )
  576. table.insert(
  577. playerCountButtons,
  578. newButton(
  579. "Reverse Play",
  580. function()
  581. gameState = "1serve"
  582. gameMode = "reversegame"
  583. end
  584. )
  585. )
  586. --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter() end))
  587. love.window.setTitle("NUCLEAR PONG")
  588. textphrases = {
  589. "Amazing",
  590. "Superb",
  591. "Absolutely beautiful!",
  592. "Awesome",
  593. "Look at That!",
  594. "Great",
  595. "Nice",
  596. "Boom!",
  597. "Dangerous!",
  598. "Astonishing!",
  599. "u/ebernerd saved me",
  600. "Absolutely Wonderful!",
  601. "Exsquisite",
  602. "Delicate",
  603. "Pow!",
  604. "Great Hit",
  605. "all hail nazarbayev"
  606. }
  607. sounds = {
  608. ["updateMusic"] = love.audio.newSource("audio/theme1.mp3", "static"),
  609. ["gayTheme"] = love.audio.newSource("audio/theme2.mp3", "static"),
  610. ["gayTheme2"] = love.audio.newSource("audio/theme3.mp3", "static"),
  611. ["gayTheme3"] = love.audio.newSource("audio/theme4.mp3", "static"),
  612. ["beep"] = love.audio.newSource("audio/hit1.mp3", "static"),
  613. ["wallhit"] = love.audio.newSource("audio/hit2.wav", "static"),
  614. ["win"] = love.audio.newSource("win.wav", "static"),
  615. ["score"] = love.audio.newSource("audio/score.wav", "static"),
  616. ["nuke"] = love.audio.newSource("audio/bomb.wav", "static"),
  617. ["striking"] = love.audio.newSource("audio/superhit.wav", "static"),
  618. ["nuclearhit"] = love.audio.newSource("audio/hit1.mp3", "static"),
  619. ["time"] = love.audio.newSource("audio/time.wav", "static")
  620. }
  621. love.graphics.setDefaultFilter("nearest", "nearest")
  622. --comic sans lmao
  623. math.randomseed(os.time())
  624. smallfont = love.graphics.newFont("font.ttf", 25)
  625. scorefont = love.graphics.newFont("font.ttf", 60)
  626. love.graphics.setFont(smallfont)
  627. --push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
  628. -- fullscreen = isFullscreen,
  629. -- resizable = true,
  630. -- vsync = true,
  631. --})
  632. player1score = 0
  633. player2score = 0
  634. areanuclear = 0
  635. player1nukescore = 0
  636. player2nukescore = 0
  637. striken = 0
  638. soundtype = 1
  639. soundturn = 1
  640. potentialstrike1 = 0
  641. potentialstrike2 = 0
  642. potentialnuke1 = 0
  643. potentialnuke2 = 0
  644. player1striken = 0
  645. player2striken = 0
  646. randomtext = 0
  647. selecting = 0
  648. number = 0
  649. elec = 1
  650. INDIC = {
  651. "",
  652. "",
  653. "",
  654. ""
  655. }
  656. --playe1nuke
  657. player1 = paddle(0, 30, 10, 100, 1)
  658. player2 = paddle(VIRTUAL_WIDTH * 0.99, VIRTUAL_HEIGHT * 0.88, 10, 100, 2)
  659. player3 = paddle(5000, 5000, 10, 100)
  660. player4 = paddle(5000, 5000, 10, 100)
  661. ball = {}
  662. ball[1] = eball(VIRTUAL_WIDTH / 2, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  663. ball[2] = eball(VIRTUAL_WIDTH / 1.9, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  664. ball[3] = eball(VIRTUAL_WIDTH / 1.8, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  665. ball[4] = eball(VIRTUAL_WIDTH / 2.2, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  666. ball[5] = eball(VIRTUAL_WIDTH / 2.1, VIRTUAL_HEIGHT / 2 - 2, 16, 16)
  667. myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y)
  668. mymenu = mainMenu()
  669. ballSpeed = 200
  670. ballDX = math.random(2) == 1 and 100 or -100
  671. ballDY = math.random(-50, 50)
  672. gameState = "animation"
  673. end
  674. t = 0
  675. shakeDuration = 0
  676. shakeMagnitude = 1
  677. function startShake(duration, magnitude)
  678. t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5
  679. end
  680. function displayFPS()
  681. --love.window.setTitle(love.timer.getFPS())
  682. love.window.setTitle(globalState .. " " .. gameState)
  683. if love.keyboard.isDown("space") then
  684. player1nukescore = 200
  685. player1score = player1score + 0.2
  686. player2nukescore = 200
  687. end
  688. end
  689. function speedControl()
  690. if (ballSpeed > maxspeed and gameState == "play") then
  691. ballSpeed = maxspeed
  692. end
  693. end
  694. function love.update(dt)
  695. --print("IMPORTANT!!!!!" .. globalState .. gameState)
  696. staticanimatorcounter(dt)
  697. musicController('norm', 1)
  698. if debug then
  699. displayFPS()
  700. end
  701. if globalState == "base" then
  702. basegame(dt)
  703. end
  704. if globalState == "menu" then
  705. debugCheck(dt)
  706. end
  707. if globalState == "nettest" then
  708. --print("Confcode: " .. confirmation)
  709. if confirmation == "N" then
  710. basegame(dt)
  711. end
  712. nettest(dt)
  713. end
  714. if globalState == "clienttest" then
  715. ts = ts + dt
  716. if confirmation == "N" then
  717. lastSentKeyP1 = lastSentKeyClient
  718. clientsBaseGame(dt)
  719. end
  720. clienttest(dt)
  721. end
  722. end
  723. serverinit = false
  724. datawaspassedtimer = 0
  725. clientinit = false
  726. function love.textinput(t)
  727. if gameState == "chooseIP" then
  728. IP = IP .. t
  729. end
  730. end
  731. function nettest(dt)
  732. if serverinit == false then
  733. local socket = require "socket"
  734. local address, port = IP, 12345
  735. print(address)
  736. udp = socket.udp()
  737. udp:setpeername(address, port)
  738. udp:settimeout(0)
  739. serverinit = true
  740. end
  741. for i = 1, maxBalls do
  742. ts = ts + dt
  743. if ts > updaterate then
  744. --print (tostring(ball[i].dy))
  745. udp:send(tostring(lastSentKey) ..
  746. '|' .. tostring(ball[i].dy) ..
  747. '|' .. tostring(player2.y) ..
  748. '|' .. tostring(player1.y) ..
  749. '|' .. tostring(player1score) ..
  750. '|' .. tostring(player2score) ..
  751. '|' .. tostring(player1nukescore) ..
  752. '|' .. tostring(player2nukescore) ..
  753. '|' .. tostring(ball[i].x) ..
  754. '|' .. tostring(ball[i].y) ..
  755. '|' .. gameState ..
  756. '|' .. tostring(ball[i].dx) ..
  757. '|' .. tostring(ballSpeed) ..
  758. '|' .. tostring(paddle_SPEED) ..
  759. "|HOST")
  760. print("SENT: " .. lastSentKey)
  761. ts = 0
  762. end
  763. end
  764. local data
  765. local datanumtest = 0
  766. local datawaspassed = false
  767. repeat
  768. datanumtest = datanumtest + 1
  769. print("LATENCY: " .. tostring(datanumtest))
  770. data = udp:receive()
  771. if data then
  772. datawaspassed = true
  773. print("ReceivedINFO: " .. data)
  774. confirmation = "N"
  775. local p = split(data, '|')
  776. if p[3] ~= "CLIENT" then
  777. confirmation = "U"
  778. end
  779. if tonumber(p[4]) > 90 then
  780. confirmation = "L"
  781. end
  782. lastSentKeyClient = p[1]
  783. player2.y = tonumber(p[2])
  784. end
  785. until not data
  786. if not datawaspassed then
  787. datawaspassedtimer = datawaspassedtimer + 1
  788. if datawaspassedtimer > 5 then
  789. confirmation = "D"
  790. datawaspassedtimer = 0
  791. end
  792. else
  793. datawaspassedtimer = 0
  794. end
  795. end
  796. function clienttest(dt)
  797. if clientinit == false then
  798. local socket = require "socket"
  799. local address, port = IP, 12345
  800. udp = socket.udp()
  801. udp:setpeername(address, port)
  802. udp:settimeout(0)
  803. udp:send(tostring(lastSentKey) ..'|' .. player2.y .. "|CLIENT")
  804. clientinit = true
  805. end
  806. ts = ts + dt
  807. if ts > updaterate then
  808. udp:send(tostring(lastSentKey) ..'|' .. player2.y .. "|CLIENT")
  809. ts = 0
  810. end
  811. local data
  812. local datanumtest = 0
  813. local datawaspassed = false
  814. repeat
  815. datanumtest = datanumtest + 1
  816. print("LATENCY: " .. tostring(datanumtest))
  817. data = udp:receive()
  818. if data then
  819. print("RECEIVED DATA: " .. data)
  820. datawaspassed = true
  821. print("SENT TO SERVER:" .. lastSentKey)
  822. confirmation = "N"
  823. local p = split(data, '|')
  824. if p[15] then
  825. if p[15] ~= "HOST" then
  826. confirmation = "U"
  827. end
  828. if tonumber(p[16]) > 90 then
  829. confirmation = "L"
  830. end
  831. for i = 1, maxBalls do
  832. local die = tonumber(p[2])
  833. lastSentKeyClient, ball[i].dy, player1.y, player1score, player2score, player1nukescore, player2nukescore, ball[i].x, ball[i].y, gameState, ball[i].dx, ballSpeed, paddle_SPEED = p[1], die, tonumber(p[4]), tonumber(p[5]), tonumber(p[6]), tonumber(p[7]), tonumber(p[8]), tonumber(p[9]), tonumber(p[10]), p[11], tonumber(p[12]), tonumber(p[13]), tonumber(p[14])
  834. end
  835. end
  836. end
  837. print("GOT: " .. lastSentKeyClient)
  838. until not data
  839. if not datawaspassed then
  840. datawaspassedtimer = datawaspassedtimer + 1
  841. if datawaspassedtimer > 5 then
  842. confirmation = "D"
  843. datawaspassedtimer = 0
  844. end
  845. else
  846. datawaspassedtimer = 0
  847. end
  848. end
  849. function wallbreaker(x, y)
  850. if (gameState == "editor") then
  851. for i, wall in ipairs(walls) do
  852. if math.abs(wall.wallx - x) < 10 and math.abs(wall.wally - y) < 10 then
  853. table.remove(walls, i)
  854. end
  855. end
  856. end
  857. end
  858. function hardmanager(diff)
  859. selecting = 1
  860. if (diff == "easy") then
  861. INDIC[1] = ">"
  862. AGAINST_AI = 1
  863. AI_SPEED = ballSet / 10
  864. AI_STRIKEMOD = 100
  865. AI_NUKEMOD = 1000
  866. AI_LEVEL = 350
  867. difficultyl = 200
  868. selecting = 0
  869. gameState = "1serve"
  870. globalState = "base"
  871. end
  872. if (diff == "normal") then
  873. INDIC[2] = ">"
  874. AI_SPEED = ballSet / 10
  875. AI_LEVEL = 500
  876. AI_NUKEMOD = 250
  877. AI_STRIKEMOD = 60
  878. AGAINST_AI = 1
  879. difficultyl = 300
  880. selecting = 0
  881. gameState = "1serve"
  882. globalState = "base"
  883. end
  884. if (diff == "hard") then
  885. INDIC[3] = ">"
  886. AI_SPEED = ballSpeed * 1.1 + 50
  887. AI_SPEED = AI_SPEED / 10
  888. AI_LEVEL = 700
  889. AI_NUKEMOD = 200
  890. AI_STRIKEMOD = 20
  891. selecting = 0
  892. difficultyl = 350
  893. AGAINST_AI = 1
  894. gameState = "1serve"
  895. globalState = "base"
  896. end
  897. if (diff == "smart") then
  898. INDIC[3] = ">"
  899. AI_SPEED = ballSpeed * 1.1 + 50
  900. AI_SPEED = AI_SPEED / 10
  901. AI_LEVEL = 1500
  902. AI_NUKEMOD = 200
  903. AI_STRIKEMOD = 20
  904. selecting = 0
  905. difficultyl = 350
  906. AGAINST_AI = 1
  907. gameState = "1serve"
  908. globalState = "base"
  909. end
  910. if (diff == "practice") then
  911. INDIC[3] = ">"
  912. AI_SPEED = ballSpeed * 500 + 50
  913. AI_SPEED = AI_SPEED / 10
  914. AI_LEVEL = 700
  915. AI_NUKEMOD = 9000000000
  916. AI_STRIKEMOD = 90000000
  917. selecting = 0
  918. difficultyl = 350
  919. AGAINST_AI = 1
  920. gameState = "base"
  921. end
  922. end
  923. function dangerChecker() --CHECK IF CONTROLS ARE DUPLICATING
  924. if (p1control.up == p1control.down) then
  925. danger = "1up"
  926. danger2 = "1down"
  927. elseif (p1control.up == p1control.super) then
  928. danger = "1up"
  929. danger2 = "1special"
  930. elseif (p1control.up == p1control.counter) then
  931. danger = "1up"
  932. danger2 = "1ct"
  933. elseif (p1control.down == p1control.super) then
  934. danger = "1down"
  935. danger2 = "1special"
  936. elseif (p1control.down == p1control.counter) then
  937. danger = "1ct"
  938. danger2 = "1down"
  939. elseif (p1control.super == p1control.counter) then
  940. danger = "1special"
  941. danger2 = "1ct"
  942. elseif (p2control.down == p2control.up) then
  943. danger = "2down"
  944. danger2 = "2up"
  945. elseif (p2control.down == p2control.super) then
  946. danger = "2down"
  947. danger2 = "2special"
  948. elseif (p2control.down == p2control.counter) then
  949. danger = "2down"
  950. danger2 = "2ct"
  951. elseif (p2control.up == p2control.super) then
  952. danger = "2up"
  953. danger2 = "2special"
  954. elseif (p2control.up == p2control.counter) then
  955. danger = "2ct"
  956. danger2 = "2up"
  957. elseif (p2control.super == p2control.counter) then
  958. danger = "2special"
  959. danger2 = "2ct"
  960. else
  961. danger = "none"
  962. danger2 = "none"
  963. end
  964. end
  965. function love.keypressed(key)
  966. lastSentKey = key
  967. if gameState == "chooseIP" then
  968. if key == "backspace" then
  969. -- get the byte offset to the last UTF-8 character in the string.
  970. local byteoffset = utf8.offset(IP, -1)
  971. if byteoffset then
  972. -- remove the last UTF-8 character.
  973. -- string.sub operates on bytes rather than UTF-8 characters, so we couldn't do string.sub(text, 1, -2).
  974. IP = string.sub(IP, 1, byteoffset - 1)
  975. end
  976. end
  977. end
  978. if gameState == "assign" then
  979. if (req == "p1up") then
  980. p1control.up = key
  981. currentKey = key
  982. --love.window.setTitle(key)
  983. gameState = "controlSettings"
  984. end
  985. if (req == "p2up") then
  986. p2control.up = key
  987. currentKey = key
  988. --love.window.setTitle(key)
  989. gameState = "controlSettings"
  990. end
  991. if (req == "p1down") then
  992. p1control.down = key
  993. currentKey = key
  994. --love.window.setTitle(key)
  995. gameState = "controlSettings"
  996. end
  997. if (req == "p2down") then
  998. p2control.down = key
  999. currentKey = key
  1000. -- love.window.setTitle(key)
  1001. gameState = "controlSettings"
  1002. end
  1003. if (req == "p1super") then
  1004. p1control.super = key
  1005. currentKey = key
  1006. -- love.window.setTitle(key)
  1007. gameState = "controlSettings"
  1008. end
  1009. if (req == "p2super") then
  1010. p2control.super = key
  1011. currentKey = key
  1012. -- love.window.setTitle(key)
  1013. gameState = "controlSettings"
  1014. end
  1015. if (req == "p1ct") then
  1016. p1control.counter = key
  1017. currentKey = key
  1018. -- love.window.setTitle(key)
  1019. gameState = "controlSettings"
  1020. end
  1021. if (req == "p2ct") then
  1022. p2control.counter = key
  1023. currentKey = key
  1024. --love.window.setTitle(key)
  1025. gameState = "controlSettings"
  1026. end
  1027. end
  1028. if key == "escape" then
  1029. TEXT = "Escape Key"
  1030. love.event.quit()
  1031. elseif key == "enter" or key == "return" then
  1032. if gameState == "start" then
  1033. resettinggenius()
  1034. gameState = "menu"
  1035. globalState = "menu"
  1036. hardmanager()
  1037. elseif (gameState == "done") then
  1038. if (player1score > player2score) then
  1039. gameState = "2serve"
  1040. potentialnuke1 = 0
  1041. potentialnuke2 = 0
  1042. striken = 0
  1043. if (nuckemodactive == 0) then
  1044. areanuclear = 0
  1045. nuclearanimation = 3
  1046. end
  1047. potentialstrike1 = 0
  1048. potentialstrike2 = 0
  1049. player1nukescore = 0
  1050. player2nukescore = 0
  1051. else
  1052. gameState = "1serve"
  1053. resettinggenius()
  1054. for i = 1, maxBalls do
  1055. ball[i]:reset(i)
  1056. end
  1057. end
  1058. else
  1059. gameState = "menu"
  1060. globalState = "menu"
  1061. if (love.math.random(0, 10) == 1) then
  1062. TEXT = "Nuclear Ching Chong"
  1063. else
  1064. TEXT = "Nuclear Pong"
  1065. end
  1066. resettinggenius()
  1067. for i = 1, maxBalls do
  1068. ball[i]:reset(i)
  1069. end
  1070. end
  1071. end
  1072. end
  1073. function love.keyreleased(key)
  1074. currentKey = " "
  1075. if lastSentKey == key then
  1076. lastSentKey = "g"
  1077. end
  1078. end
  1079. function speedSetter(requesttype)
  1080. if (requesttype == "ball") then
  1081. if (ballSet > 550) then
  1082. ballSet = 0
  1083. paddle_SPEED = 0
  1084. else
  1085. ballSet = ballSet + 50
  1086. paddle_SPEED = paddle_SPEED + 5
  1087. end
  1088. ballSpeed = ballSet
  1089. end
  1090. if (requesttype == "snc") then
  1091. synctype = synctype + 1
  1092. if (synctype > 1) then
  1093. synctype = 0
  1094. end
  1095. if synctype == 0 then
  1096. synctext = "Independent"
  1097. end
  1098. if synctype == 1 then
  1099. synctext = "Synchronised"
  1100. end
  1101. end
  1102. if (requesttype == "nuclearmod") then
  1103. nuckemodactive = nuckemodactive + 1
  1104. if (nuckemodactive > 1) then
  1105. nuckemodactive = 0
  1106. end
  1107. if (nuckemodactive == 0) then
  1108. areanuclear = 0
  1109. nuclearanimation = 3
  1110. ballSet = 200
  1111. TEXT = "Nuclear Pong"
  1112. synctype = 0
  1113. maxspeed = 700
  1114. synctext = "Independent"
  1115. paddle_SPEED = ballSet / 10
  1116. AI_SPEED = ballSet / 10
  1117. end
  1118. if (nuckemodactive == 1) then
  1119. areanuclear = 1
  1120. ballSet = 2000
  1121. maxspeed = 2000
  1122. paddle_SPEED = ballSet / 10
  1123. AI_SPEED = ballSet / 10
  1124. synctext = "death is imminent"
  1125. end
  1126. ballSpeed = ballSet
  1127. end
  1128. if (requesttype == "practice") then
  1129. if (ballSpeed > 999) then
  1130. ballSpeed = 200
  1131. ballSet = 200
  1132. end
  1133. if (ballSpeed > 799) then
  1134. prtext = "Insane"
  1135. maxBalls = 5
  1136. elseif ballSpeed > 599 then
  1137. prtext = "Hard"
  1138. maxBalls = 4
  1139. elseif ballSpeed > 399 then
  1140. prtext = "Normal"
  1141. maxBalls = 3
  1142. elseif ballSpeed > 199 then
  1143. prtext = "Easy"
  1144. maxBalls = 3
  1145. end
  1146. ballSpeed = ballSpeed + 200
  1147. ballSet = ballSet + 200
  1148. end
  1149. if (requesttype == "reset") then
  1150. ballSpeed = 200
  1151. ballSet = 200
  1152. synctype = 0
  1153. prtext = "Easy"
  1154. maxBalls = 1
  1155. end
  1156. if (requesttype == "pc") then
  1157. if (playerCount == 2) then
  1158. playerCount = 1
  1159. playertext = "1v1"
  1160. elseif (playerCount == 1) then
  1161. playerCount = playerCount + 1
  1162. player3.x = player1.x + VIRTUAL_WIDTH / 2
  1163. player3.y = player3.y
  1164. playertext = "2v2"
  1165. end
  1166. end
  1167. if (requesttype == "ballz") then
  1168. if (maxBalls > 1) then
  1169. --love.window.setTitle("more than 4")
  1170. maxBalls = 1
  1171. else
  1172. maxBalls = maxBalls + 1
  1173. end
  1174. end
  1175. if requesttype == "ptw" then
  1176. if ptw == 10 then
  1177. ptw = 1
  1178. else
  1179. ptw = ptw + 1
  1180. end
  1181. end
  1182. end
  1183. function gameModeChanger()
  1184. if (gameState == "gameMode") then
  1185. local button_width = VIRTUAL_WIDTH * (1 / 3)
  1186. local BUTTON_HEIGHT = 50
  1187. local margin = 20
  1188. local hot = false
  1189. local cursor_y = 0
  1190. local total_height = (BUTTON_HEIGHT + margin) * #buttons
  1191. for i, button in ipairs(modeSelectorButtons) do
  1192. button.last = button.now
  1193. local bx = (VIRTUAL_WIDTH * 0.5) - (button_width * 0.5)
  1194. local by = (VIRTUAL_HEIGHT * 0.5) - (total_height * 0.5) + cursor_y
  1195. local color = {255, 255, 255, 255}
  1196. local mx, my = love.mouse.getPosition()
  1197. mx = mx * DIFFERENCE_X
  1198. my = my * DIFFERENCE_Y
  1199. hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
  1200. if (hot == i) then
  1201. color = {10, 10, 0, 255}
  1202. end
  1203. button.now = love.mouse.isDown(1)
  1204. if button.now and not button.last and hot == i then
  1205. love.graphics.setColor(0, 0, 0, 1)
  1206. love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
  1207. sounds["wallhit"]:play()
  1208. button.fn()
  1209. end
  1210. love.graphics.setColor(unpack(color))
  1211. love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
  1212. love.graphics.setColor(0, 0, 0, 255)
  1213. local textW = smallfont:getWidth(button.text)
  1214. local textH = smallfont:getHeight(button.text)
  1215. love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5)
  1216. love.graphics.setColor(255, 255, 255, 255)
  1217. cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
  1218. end
  1219. end
  1220. if (gameState == "multiMode") then
  1221. local button_width = VIRTUAL_WIDTH * (1 / 3)
  1222. local BUTTON_HEIGHT = 50
  1223. local margin = 20
  1224. local hot = false
  1225. local cursor_y = 0
  1226. local total_height = (BUTTON_HEIGHT + margin) * #buttons
  1227. for i, button in ipairs(playerCountButtons) do
  1228. button.last = button.now
  1229. local bx = (VIRTUAL_WIDTH * 0.5) - (button_width * 0.5)
  1230. local by = (VIRTUAL_HEIGHT * 0.3) - (total_height * 0.5) + cursor_y
  1231. if (button.text == "Play") then
  1232. by = by + by / 1.8
  1233. end
  1234. local color = {255, 255, 255, 255}
  1235. local mx, my = love.mouse.getPosition()
  1236. mx = mx * DIFFERENCE_X
  1237. my = my * DIFFERENCE_Y
  1238. hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i
  1239. if (hot == i) then
  1240. if (button.text == "Play") then
  1241. color = {0 / 255, 255 / 255, 0 / 255, 255}
  1242. else
  1243. color = {10, 10, 0, 255}
  1244. end
  1245. end
  1246. button.now = love.mouse.isDown(1)
  1247. if button.now and not button.last and hot == i then
  1248. love.graphics.setColor(0, 0, 0, 1)
  1249. love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
  1250. sounds["wallhit"]:play()
  1251. if button.text == "Ball Speed: " and nuckemodactive == 1 then
  1252. else
  1253. button.fn()
  1254. end
  1255. end
  1256. love.graphics.setColor(unpack(color))
  1257. love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT)
  1258. love.graphics.setColor(0, 0, 0, 255)
  1259. local textW = smallfont:getWidth(button.text)
  1260. local textH = smallfont:getHeight(button.text)
  1261. if (button.text == "1v1") then
  1262. love.graphics.print(playertext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5)
  1263. elseif button.text == "snc" then
  1264. if (nuckemodactive == 1) then
  1265. love.graphics.setColor(1, 0, 0, 1)
  1266. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5)
  1267. love.graphics.setColor(1, 1, 1, 1)
  1268. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5)
  1269. love.graphics.setColor(0, 0, 0, 1)
  1270. else
  1271. --
  1272. love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.45 - textW * 0.5, by + textH * 0.5)
  1273. end
  1274. elseif (button.text == "ballCount") then
  1275. love.graphics.print(
  1276. "Ball Count: " .. maxBalls,
  1277. smallfont,
  1278. VIRTUAL_WIDTH * 0.5 - textW * 0.5,
  1279. by + textH * 0.5
  1280. )
  1281. elseif (button.text == "Ball Speed: ") then
  1282. if (nuckemodactive == 1) then
  1283. love.graphics.setColor(1, 0, 0, 1)
  1284. love.graphics.print(
  1285. "shaitan machina",
  1286. smallfont,
  1287. VIRTUAL_WIDTH * 0.5 - textW * 0.5,
  1288. by + textH * 0.5
  1289. )
  1290. love.graphics.setColor(1, 1, 1, 1)
  1291. love.graphics.print(
  1292. "shaitan machina",
  1293. smallfont,
  1294. VIRTUAL_WIDTH * 0.5 - textW * 0.5,
  1295. by + textH * 0.5
  1296. )
  1297. love.graphics.setColor(0, 0, 0, 1)
  1298. else
  1299. love.graphics.print(
  1300. button.text .. ballSet,
  1301. smallfont,
  1302. VIRTUAL_WIDTH * 0.5 - textW * 0.5,
  1303. by + textH * 0.5
  1304. )
  1305. end
  1306. elseif button.text == "ptw" then
  1307. love.graphics.print(
  1308. "Points to Win: " .. ptw,
  1309. smallfont,
  1310. VIRTUAL_WIDTH * 0.5 - textW * 1.5,
  1311. by + textH * 0.5
  1312. )
  1313. else
  1314. love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5)
  1315. end
  1316. love.graphics.setColor(255, 255, 255, 255)
  1317. cursor_y = cursor_y + (BUTTON_HEIGHT + margin)
  1318. end
  1319. end
  1320. end
  1321. function love.draw()
  1322. simpleScale.set()
  1323. baseDraw()
  1324. if (globalState == "nettest" or globalState == "clienttest") and confirmation == "D" then
  1325. love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255)
  1326. love.graphics.printf("WAIT FOR PLAYER 2", 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
  1327. end
  1328. if (globalState == "nettest" or globalState == "clienttest") and confirmation == "U" then
  1329. love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255)
  1330. love.graphics.printf("LOBBY FULL OR WRONG MODE CHOSEN", 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
  1331. end
  1332. if (globalState == "nettest" or globalState == "clienttest") and confirmation == "L" then
  1333. love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255)
  1334. love.graphics.printf("POOR CONNECTION TO SERVER", 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center")
  1335. end
  1336. simpleScale.unSet()
  1337. end
  1338. --Check if controls are duplicating
  1339. function controllerSer()
  1340. for i = 1, maxBalls do
  1341. if (ball[i].dy == 0) then
  1342. hitNum[i] = hitNum[i] + 1
  1343. if hitNum[i] >= 10 then
  1344. ball[i].dy = 1
  1345. hitNum[i] = 0
  1346. end
  1347. else
  1348. hitNum[i] = 0
  1349. end
  1350. end
  1351. end
  1352. function palleteController() --!!!!LEGACY CODE, MIGRATED TO Paddle.lua!!!!
  1353. if (areanuclear == 0) then
  1354. player1.RED = 1
  1355. player1.GREEN = 1
  1356. player1.BLUE = 1
  1357. end
  1358. if (areanuclear == 0) then
  1359. player2.RED = 1
  1360. player2.GREEN = 1
  1361. player2.BLUE = 1
  1362. end
  1363. if (areanuclear == 1) then
  1364. player1.RED = 0
  1365. player1.GREEN = 0
  1366. player1.BLUE = 0
  1367. end
  1368. if (areanuclear == 1) then
  1369. player2.RED = 0
  1370. player2.GREEN = 0
  1371. player2.BLUE = 0
  1372. end
  1373. end
  1374. function love.wheelmoved(x, y)
  1375. if (y < 0 and wall1width > 0) then
  1376. wall1width = wall1width - 5
  1377. elseif y > 0 and wall1width < 900 then
  1378. wall1width = wall1width + 5
  1379. end
  1380. end
  1381. function serveBot() --THIS IS USED TO CHANGE TEXT/BALL DIRECTION ON DIFFERENT SERVES
  1382. --print("servebot called")
  1383. if (gameState == "1serve") then
  1384. updateTEXT = ""
  1385. if (gameMode ~= "practice") then
  1386. TEXT = "PLAYER 1, serve!(q)"
  1387. end
  1388. if ((globalState ~= "clienttest" and love.keyboard.isDown("q")) or (globalState == "clienttest" and lastSentKeyP1 == "q")) then
  1389. TEXT = "Lets Begin!"
  1390. ball_DIR = 1
  1391. for i = 1, maxBalls do
  1392. ball[i]:reset(i)
  1393. end
  1394. gameState = "play"
  1395. end
  1396. end
  1397. if (gameState == "2serve") then
  1398. TEXT = "PLAYER 2, serve!(p)"
  1399. if (AGAINST_AI == 1) then
  1400. TEXT = ""
  1401. ball_DIR = -1
  1402. for i = 1, maxBalls do
  1403. ball[i]:reset(i)
  1404. end
  1405. gameState = "play"
  1406. end
  1407. if (((globalState == "nettest" and lastSentKeyClient == "p") or ((globalState ~= "nettest") and love.keyboard.isDown("p")))and AGAINST_AI == 0) then
  1408. TEXT = "Lets Begin"
  1409. ball_DIR = -1
  1410. for i = 1, maxBalls do
  1411. ball[i]:reset(i)
  1412. end
  1413. --love.window.setTitle("An atttttttt")
  1414. gameState = "play"
  1415. end
  1416. end
  1417. end
  1418. function mapChanger()
  1419. if (gameState == "editor") then
  1420. MAP_TYPE = 2
  1421. end
  1422. if (MAP_TYPE > 2) then
  1423. MAP_TYPE = 0
  1424. end
  1425. end
  1426. function resolutionChanger()
  1427. if (RESOLUTION_SET > 1) then
  1428. RESOLUTION_SET = 0
  1429. end
  1430. if (RESOLUTION_SET == 0) then
  1431. if (isFullscreen == 1) then
  1432. DIFFERENCE_X = 1
  1433. DIFFERENCE_Y = 1
  1434. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = false})
  1435. isFullscreen = 0
  1436. end
  1437. end
  1438. if (RESOLUTION_SET == 1) then
  1439. if (isFullscreen == 0) then
  1440. simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true})
  1441. local newWidth = love.graphics.getWidth()
  1442. local newHeight = love.graphics.getHeight()
  1443. DIFFERENCE_X = VIRTUAL_WIDTH / newWidth
  1444. DIFFERENCE_Y = VIRTUAL_HEIGHT / newHeight
  1445. isFullscreen = 1
  1446. end
  1447. end
  1448. end
  1449. function resettinggenius()
  1450. maxBalls = 1
  1451. for i = 1, maxBalls do
  1452. ball[i]:reset(i)
  1453. end
  1454. paddle_SPEED = 20
  1455. nuclearanimation = 3
  1456. timeIsSlow = false
  1457. timeIsSlow2 = false
  1458. originalSpeed = 200
  1459. gameState = "menu"
  1460. globalState = "menu"
  1461. gameMode = "normal"
  1462. player1.height = 100
  1463. player2.height = 100
  1464. ballSet = 200
  1465. ballSpeed = ballSet
  1466. player2.GREEN = 255
  1467. player2.BLUE = 255
  1468. player1.GREEN = 255
  1469. player1.BLUE = 255
  1470. player1score = 0
  1471. player2score = 0
  1472. potentialnuke1 = 0
  1473. potentialnuke2 = 0
  1474. striken = 0
  1475. areanuclear = 0
  1476. potentialstrike1 = 0
  1477. potentialstrike2 = 0
  1478. player1nukescore = 0
  1479. player2nukescore = 0
  1480. player1reverbav = 0
  1481. player2reverbav = 0
  1482. selecting = 0
  1483. AGAINST_AI = 0
  1484. end
  1485. function love.mousereleased(x, y, button)
  1486. love.keyboard.mouseisReleased = true
  1487. if (gameState == "editor") then
  1488. if (#walls < 1000 and button == 1 and blockinput ~= true) then
  1489. table.insert(walls, newWall(x * DIFFERENCE_X, y * DIFFERENCE_Y, 10, wall1width))
  1490. end
  1491. end
  1492. end
  1493. function ballsAlive()
  1494. for i = 1, maxBalls do
  1495. if ball[i].disabled == false then
  1496. print("Ball " .. i .. " is not disabled")
  1497. return true
  1498. end
  1499. end
  1500. return false
  1501. end
  1502. function split(s, delimiter)
  1503. result = {}
  1504. for match in (s..delimiter):gmatch("(.-)"..delimiter) do
  1505. table.insert(result, match)
  1506. end
  1507. return result
  1508. end