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