A pong clone, but with a twist!
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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