diff --git a/button.lua b/button.lua index 0e9d339..9e704a7 100644 --- a/button.lua +++ b/button.lua @@ -1,11 +1,12 @@ button = Class{} -function button:init(x, y, width, height, color) +function button:init(x, y, width, height, color, skipAnim) self.x = x self.y = y self.w = width self.h = height self.color = color + self.skipAnim = skipAnim end function button:update(dt) diff --git a/buttonManager.lua b/buttonManager.lua deleted file mode 100644 index 3c6e00f..0000000 --- a/buttonManager.lua +++ /dev/null @@ -1,47 +0,0 @@ -mainMenu = Class{} -function resolutionButtons(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons) - - if (gameState == 'windowsettings') then - - local ev_button_width = VIRTUAL_WIDTH * (1/3) - local ev_BUTTON_HEIGHT = 50 - local margin = 16 - local hot = false - local cursor_y = 0 - local total_height = (ev_BUTTON_HEIGHT + margin) * #settings - for i, button in ipairs(buttons) do - button.last = button.now - local ev_bx = (VIRTUAL_WIDTH*0.8) - (ev_button_width * 0.5) - local ev_by = (VIRTUAL_HEIGHT * 0.5) - (total_height * 0.5) + cursor_y - local color = {255, 255, 255, 255} - local mx, my = love.mouse.getPosition() - local mx = mx * DIFFERENCE_X - local my = my * DIFFERENCE_Y - local hot = (mx > ev_bx and mx < ev_bx + ev_button_width and my > ev_by and my < ev_by + ev_BUTTON_HEIGHT) and i - if (hot == i) then - color = {10, 10, 0, 255} - end - button.now = love.mouse.isDown(1) - if button.now and not button.last and hot == i then - love.graphics.setColor(0,0,0,1) - love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) - -- sounds['wallhit']:play() - button.fn() - end - love.graphics.setColor(unpack(color)) - love.graphics.rectangle("fill", ev_bx,ev_by, ev_button_width, ev_BUTTON_HEIGHT) - love.graphics.setColor(0, 0, 0, 255) - local textW = smallfont:getWidth(button.text) - local textH = smallfont:getHeight(button.text) - love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH*0.8 - textW*0.5, ev_by+textH*0.5) - - love.graphics.setColor(255, 255, 255, 255) - cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) - - end - - - end - - - end diff --git a/gifload.lua b/gifload.lua deleted file mode 100644 index 28a35c7..0000000 --- a/gifload.lua +++ /dev/null @@ -1,519 +0,0 @@ ---[===================================================================[-- - Copyright © 2016, 2018 Pedro Gimeno Fortea. All rights reserved. - - Permission is hereby granted to everyone to copy and use this file, - for any purpose, in whole or in part, free of charge, provided this - single condition is met: The above copyright notice, together with - this permission grant and the disclaimer below, should be included - in all copies of this software or of a substantial portion of it. - - THIS SOFTWARE COMES WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. ---]===================================================================]-- - --- GIF(sm) image decoder for the love2d framework, using LuaJIT + FFI. --- Includes LZW decompression. - - -local ffi = require 'ffi' -local bit = require 'bit' - --- We have a "double buffer" coroutine-based consumer-producer system --- requiring the consumer to not request large chunks at a time --- otherwise the buffer would overflow (this is detected but it will --- cause an assertion error). - -local bytearray = ffi.typeof('uint8_t[?]') -local intarray = ffi.typeof('int[?]') -local int32ptr = ffi.typeof('int32_t *') - --- Interlaced mode table. Format: --- {initial value for pass 1, increment for pass 1, --- initial value for pass 2, increment for pass 2, ...} -local intertable = {0, 8, 4, 8, 2, 4, 1, 2, false} - --- Utility function for error propagation -local function coresume(co, ...) - local ok, err = coroutine.resume(co, ...) - if not ok then - error(err) - end -end - --- Consumer -local function gifread(self, length) - while self.ptr + length >= self.buflen do - coroutine.yield() -- wait for more input - end - local tmp = self.ptr - self.ptr = self.ptr + length - if tmp >= 24576 then -- this leaves 8192 as max read length (768 would probably suffice) - ffi.copy(self.buffer, self.buffer + tmp, self.buflen - tmp) - self.buflen = self.buflen - tmp - self.ptr = self.ptr - tmp - tmp = 0 - end - return tmp, length -end - --- Producer - prepare the data for the consumer -local function gifupdate(self, s) - if #s > 32768 then - -- Creating a Lua string object is an expensive operation. - -- Do it as seldom as possible. We split the input data - -- into 32K chunks. - for i = 1, #s, 32768 do - gifupdate(self, s:sub(i, i + 32767)) - end - return - end - - if coroutine.status(self.decoder) == "dead" then - -- feeding data after the decoding is finished, ignore - return - end - assert(self.buflen <= 32768, "Buffer overflow") - - ffi.copy(self.buffer + self.buflen, s, #s) - self.buflen = self.buflen + #s - coresume(self.decoder) - return self -end - -local function gifdone(self) - -- free C memory immediately - self.buffer = false - return self -end - -local function giferr(self, msg) - print(msg) -end - --- Gif decoding aux functions -local function gifpalette(palette, source, psize) - -- Read a palette, inserting alpha - for i = 0, psize - 1 do - palette[i*4] = source[i*3] - palette[i*4 + 1] = source[i*3 + 1] - palette[i*4 + 2] = source[i*3 + 2] - palette[i*4 + 3] = 255 - end -end - --- Gif decoder proper -local function gifdecoder(self) - -- Read file ID and header - local buffer = self.buffer - gifread(self, 13) - if ffi.string(self.buffer, 6) ~= 'GIF87a' - and ffi.string(self.buffer, 6) ~= 'GIF89a' - then - self:err('Invalid GIF file format') - return - end - self.width = buffer[6] + 256*buffer[7] - self.height = buffer[8] + 256*buffer[9] - local gpalettesize = buffer[10] >= 128 and bit.lshift(1, bit.band(buffer[10], 7) + 1) or 0 - local background = buffer[11] - self.aspect = ((buffer[12] == 0 and 49 or 0) + 15) / 64 - - local gpalette = bytearray(256*4) - local lpalette = bytearray(256*4) - local lpalettesize - -- Read palette and set background - self.background = background -- default value - if gpalettesize > 0 then - gifread(self, gpalettesize * 3) - gifpalette(gpalette, buffer + 13, gpalettesize) - - if background < gpalettesize then - self.background = {gpalette[background*4], gpalette[background*4+1], gpalette[background*4+2]} - end - end - - local p - local GCE_trans = false - local GCE_dispose = 0 - local GCE_delay = 0 - - -- Allocate the buffers in advance, to reuse them for every frame - local dict = bytearray(4096) - local dictptrs = intarray(4096) - local reversebuf = bytearray(4096) - - repeat - -- Get block type - p = gifread(self, 1) - local blocktype = 0x3B - local blocklen - -- for simplicity (?), we fuse the block type and the extension type into - -- 'blocktype' - if buffer[p] == 0x2C then - -- Image block - blocktype = 0x2C - elseif buffer[p] == 0x21 then - -- Extension block - p = gifread(self, 1) - blocktype = buffer[p] - if blocktype == 0x2C then - -- there's no extension 2C - terminate - -- (avoids ambiguity with block type 2C) - blocktype = 0x3B - end - elseif buffer[p] ~= 0x3B then - self:err(string.format("Unknown block type: 0x%02X", buffer[p])) - break - end - - if blocktype == 0x3B then - -- Trailer block or invalid block - terminate - break - - elseif blocktype == 0xFF then - -- Application extension - may be loop, otherwise skip - p = gifread(self, 1) - blocklen = buffer[p] - p = gifread(self, blocklen + 1) - if blocklen >= 11 and ffi.string(buffer + p, 11) == 'NETSCAPE2.0' then - -- these *are* the androids we're looking for - p = p + blocklen - while buffer[p] ~= 0 do - local sblen = buffer[p] - p = gifread(self, sblen + 1) -- read also the next block length - if buffer[p] == 1 and sblen >= 3 then - -- looping subblock - that's for us - self.loop = buffer[p + 1] + 256 * buffer[p + 2] - end - p = p + sblen -- advance to next block - end - else - -- skip entire block - p = p + blocklen - while buffer[p] ~= 0 do - gifread(self, buffer[p]) - p = gifread(self, 1) - end - end - - elseif blocktype == 0x01 or blocktype == 0xFE then - -- Text or Comment Extension - not processed by us, skip - p = gifread(self, 1) -- read length - if blocktype < 0x01 then - -- skip the block header (contains a length field) - p = gifread(self, buffer[p] + 1) + buffer[p] - - -- the text extension "consumes" the GCE, so we clear it - GCE_trans = false - GCE_dispose = 0 - GCE_delay = 0 - end - while buffer[p] ~= 0 do - p = gifread(self, buffer[p] + 1) + buffer[p] - end - - elseif blocktype == 0xF9 then - -- Graphic Control Extension - p = gifread(self, 1) - blocklen = buffer[p] - p = gifread(self, blocklen + 1) - if blocklen >= 4 then - GCE_delay = (buffer[p+1] + 256 * buffer[p+2]) / 100 - GCE_trans = bit.band(buffer[p], 1) ~= 0 and buffer[p + 3] - GCE_dispose = bit.rshift(bit.band(buffer[p], 0x1C), 2) - end - p = p + blocklen - while buffer[p] ~= 0 do - p = gifread(self, buffer[p] + 1) + buffer[p] - end - elseif blocktype == 0x2C then - -- Here be dragons - p = gifread(self, 9) - - local x, y = buffer[p] + 256*buffer[p+1], buffer[p+2] + 256*buffer[p+3] - local w, h = buffer[p+4] + 256*buffer[p+5], buffer[p+6] + 256*buffer[p+7] - if w == 0 or h == 0 then - self:err('Zero size image') - break - end - local img = love.image.newImageData(w, h) - local dataptr = ffi.cast(int32ptr, img:getPointer()) - self.imgs[#self.imgs + 1] = GCE_dispose - self.imgs[#self.imgs + 1] = GCE_delay - self.imgs[#self.imgs + 1] = img - self.imgs[#self.imgs + 1] = x - self.imgs[#self.imgs + 1] = y - self.nimages = self.nimages + 1 - - local flags = buffer[p+8] - if flags >= 128 then - -- Has local palette - lpalettesize = bit.lshift(1, bit.band(flags, 7) + 1) - p = gifread(self, lpalettesize*3) - gifpalette(lpalette, buffer + p, lpalettesize) - else - -- No local palette - copy the global palette to the local one - ffi.copy(lpalette, gpalette, gpalettesize*4) - lpalettesize = gpalettesize - end - if GCE_trans and GCE_trans < lpalettesize then - -- Clear alpha - lpalette[GCE_trans*4 + 3] = 0 - end - local interlace = bit.band(flags, 64) ~= 0 and 1 - - -- LZW decoder. - - -- This could really use another coroutine for - -- simplicity, as there's another producer/consumer, - -- but we won't go there. - - p = gifread(self, 2) - local LZWsize = buffer[p] - p = p + 1 - if LZWsize == 0 or LZWsize > 11 then - self:err("Invalid code size") - break - end - local codebits = LZWsize + 1 - local clearcode = bit.lshift(1, LZWsize) -- End-of-stream is always clearcode+1 - local dictlen = clearcode + 2 - - local bitstream, bitlen = 0, 0 - x, y = 0, 0 - local nextlenptr = p - local oldcode - local walkcode - - local nrows = 0 -- counts vertical rows, used because interlacing makes the last y invalid - local row = 0 - - repeat - -- Are there enough bits in curcode? Do we need to read more data? - if bitlen >= codebits and y then - -- Extract next code - local code = bit.band(bitstream, bit.lshift(1, codebits) - 1) - bitstream = bit.rshift(bitstream, codebits) - bitlen = bitlen - codebits - - if code == clearcode then - codebits = LZWsize + 1 - dictlen = clearcode + 2 - oldcode = false - elseif code == clearcode + 1 then - if x ~= 0 or nrows ~= h then - self:err("Soft EOD before all rows were output") - end - -- signal end of processing - -- (further data won't be read, but we need to follow the blocks) - y = false - else - -- The dictionary is stored as a list of back pointers. - -- We need to reverse the order to output the entries. - -- We use a reverse buffer for that. - local reverseptr = 4095 - -- Is this code already in the table? - if code < dictlen then - -- Already in the table - get the string from the table - walkcode = code - while walkcode >= clearcode do - reversebuf[reverseptr] = dict[walkcode] - reverseptr = reverseptr - 1 - walkcode = dictptrs[walkcode] - end - reversebuf[reverseptr] = walkcode - -- Add to the table - if oldcode then - if dictlen < 4096 then - dictptrs[dictlen] = oldcode - dict[dictlen] = walkcode - dictlen = dictlen + 1 - if dictlen ~= 4096 and bit.band(dictlen, dictlen - 1) == 0 then - -- perfect power of two - increase code size - codebits = codebits + 1 - end - end - end - oldcode = code - else - -- Not in the table - deal with the special case - -- The compressor has created a new code, which must be the next - -- in sequence. We know what it must contain. - -- It must contain oldcode + first character of oldcode. - if code > dictlen or not oldcode or not walkcode then - self:err("Broken LZW") - break - end - - -- Add to the table - if oldcode then - if dictlen < 4096 then - dictptrs[dictlen] = oldcode - dict[dictlen] = walkcode - dictlen = dictlen + 1 - if dictlen ~= 4096 and bit.band(dictlen, dictlen - 1) == 0 then - -- perfect power of two - increase code size - codebits = codebits + 1 - end - end - end - oldcode = code - walkcode = oldcode - - while walkcode >= clearcode do - reversebuf[reverseptr] = dict[walkcode] - reverseptr = reverseptr - 1 - walkcode = dictptrs[walkcode] - end - reversebuf[reverseptr] = walkcode - end - - if y then - for i = reverseptr, 4095 do - local c = reversebuf[i] - if c >= lpalettesize then c = 0 end - c = ffi.cast(int32ptr, lpalette)[c] - dataptr[x + row] = c - if interlace then - -- The passes 1, 2, 3, 4 correspond to the - -- values 1, 3, 5, 7 of 'interlace'. - if self.progressive and interlace < 7 and y + 1 < h then - -- In any pass but the last, there are at least 2 lines. - dataptr[x + row + w] = c - if interlace < 5 and y + 2 < h then - -- In the first two passes, there are at least 4 lines. - dataptr[x + row + w*2] = c - if y + 3 < h then - dataptr[x + row + w*3] = c - if interlace < 3 and y + 4 < h then - -- In the first pass there are 8 lines. - dataptr[x + row + w*4] = c - if y + 5 < h then - dataptr[x + row + w*5] = c - if y + 6 < h then - dataptr[x + row + w*6] = c - if y + 7 < h then - dataptr[x + row + w*7] = c - end - end - end - end - end - end - end - -- Advance pixel - x = x + 1 - if x >= w then - -- Skip to next interlaced row - x = 0 - nrows = nrows + 1 - y = y + intertable[interlace + 1] - if y >= h then - interlace = interlace + 2 - if interlace > 7 then - y = false - else - y = intertable[interlace] - end - end - if y then - row = y * w - end - end - else - -- No interlace, just increment y - x = x + 1 - if x >= w then - x = 0 - y = y + 1 - nrows = y - if y >= h then - y = false - else - row = y * w - end - end - end - end - - else - -- This should not happen. - self:err('Data past the end of the image') - end - end - else - -- Not enough bits, grab 8 more - if p >= nextlenptr then - -- End of this subblock - read next subblock - assert(p == nextlenptr) - local sblen = buffer[nextlenptr] - - if sblen == 0 then - -- no more data - if y then - self:err("Hard EOD before the end of the image") - end - break - end - p = gifread(self, sblen + 1) - nextlenptr = p + sblen - end - if y then - bitstream = bitstream + bit.lshift(buffer[p], bitlen) - bitlen = bitlen + 8 - p = p + 1 - else - -- end of data - fast forward to end of block - p = nextlenptr - end - end - - until false - - GCE_trans = false - GCE_dispose = 0 - GCE_delay = 0 - self.ncomplete = self.nimages - - else - break - end - until false - -end - -local function gifframe(self, n) - n = (n-1) % self.nimages + 1 - return self.imgs[n*5-2], self.imgs[n*5-1], self.imgs[n*5], self.imgs[n*5-3], self.imgs[n*5-4] -end - -local function gifnew(retver) - if retver == "version" then - return 0x010002 - -- else just ignore it and create the object - end - - local self = { - update = gifupdate; - done = gifdone; - frame = gifframe; - err = giferr; - background = false; - width = false; - height = false; - imgs = {}; - nimages = 0; - ncomplete = 0; - buffer = bytearray(65536); - buflen = 0; - ptr = 0; - progressive = false; - loop = false; - aspect = false; - decoder = coroutine.create(gifdecoder); - } - -- pass self to the coroutine (will return immediately for lack of data) - coresume(self.decoder, self) - return self -end - -return gifnew \ No newline at end of file diff --git a/img/SPC/Engine Thrusters/diagonal-thrust-01.png b/img/SPC/Engine Thrusters/diagonal-thrust-01.png deleted file mode 100644 index 3189f88..0000000 Binary files a/img/SPC/Engine Thrusters/diagonal-thrust-01.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/diagonal-thrust-02.png b/img/SPC/Engine Thrusters/diagonal-thrust-02.png deleted file mode 100644 index 8893003..0000000 Binary files a/img/SPC/Engine Thrusters/diagonal-thrust-02.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/diagonal-thrust-03.png b/img/SPC/Engine Thrusters/diagonal-thrust-03.png deleted file mode 100644 index bc95aa1..0000000 Binary files a/img/SPC/Engine Thrusters/diagonal-thrust-03.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/diagonal-thrust-04.png b/img/SPC/Engine Thrusters/diagonal-thrust-04.png deleted file mode 100644 index 9b39010..0000000 Binary files a/img/SPC/Engine Thrusters/diagonal-thrust-04.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/vertical-thrust-01.png b/img/SPC/Engine Thrusters/vertical-thrust-01.png deleted file mode 100644 index 4587b49..0000000 Binary files a/img/SPC/Engine Thrusters/vertical-thrust-01.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/vertical-thrust-02.png b/img/SPC/Engine Thrusters/vertical-thrust-02.png deleted file mode 100644 index b46abf8..0000000 Binary files a/img/SPC/Engine Thrusters/vertical-thrust-02.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/vertical-thrust-03.png b/img/SPC/Engine Thrusters/vertical-thrust-03.png deleted file mode 100644 index 8eaf0f1..0000000 Binary files a/img/SPC/Engine Thrusters/vertical-thrust-03.png and /dev/null differ diff --git a/img/SPC/Engine Thrusters/vertical-thrust-04.png b/img/SPC/Engine Thrusters/vertical-thrust-04.png deleted file mode 100644 index eca32dd..0000000 Binary files a/img/SPC/Engine Thrusters/vertical-thrust-04.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-1.png b/img/SPC/Explosion/explosion-1.png deleted file mode 100644 index 0b7b2d7..0000000 Binary files a/img/SPC/Explosion/explosion-1.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-10.png b/img/SPC/Explosion/explosion-10.png deleted file mode 100644 index e22683d..0000000 Binary files a/img/SPC/Explosion/explosion-10.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-11.png b/img/SPC/Explosion/explosion-11.png deleted file mode 100644 index 46e2784..0000000 Binary files a/img/SPC/Explosion/explosion-11.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-2.png b/img/SPC/Explosion/explosion-2.png deleted file mode 100644 index 5df7b2d..0000000 Binary files a/img/SPC/Explosion/explosion-2.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-3.png b/img/SPC/Explosion/explosion-3.png deleted file mode 100644 index 09360a7..0000000 Binary files a/img/SPC/Explosion/explosion-3.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-4.png b/img/SPC/Explosion/explosion-4.png deleted file mode 100644 index 3d8803d..0000000 Binary files a/img/SPC/Explosion/explosion-4.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-5.png b/img/SPC/Explosion/explosion-5.png deleted file mode 100644 index d2cfd75..0000000 Binary files a/img/SPC/Explosion/explosion-5.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-6.png b/img/SPC/Explosion/explosion-6.png deleted file mode 100644 index 42547db..0000000 Binary files a/img/SPC/Explosion/explosion-6.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-7.png b/img/SPC/Explosion/explosion-7.png deleted file mode 100644 index f13265a..0000000 Binary files a/img/SPC/Explosion/explosion-7.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-8.png b/img/SPC/Explosion/explosion-8.png deleted file mode 100644 index 80a3a4a..0000000 Binary files a/img/SPC/Explosion/explosion-8.png and /dev/null differ diff --git a/img/SPC/Explosion/explosion-9.png b/img/SPC/Explosion/explosion-9.png deleted file mode 100644 index 5d839a3..0000000 Binary files a/img/SPC/Explosion/explosion-9.png and /dev/null differ diff --git a/img/SPC/Projectiles/missile-01.png b/img/SPC/Projectiles/missile-01.png deleted file mode 100644 index b715133..0000000 Binary files a/img/SPC/Projectiles/missile-01.png and /dev/null differ diff --git a/img/SPC/Projectiles/missile-02.png b/img/SPC/Projectiles/missile-02.png deleted file mode 100644 index 8fa0e05..0000000 Binary files a/img/SPC/Projectiles/missile-02.png and /dev/null differ diff --git a/img/SPC/Projectiles/projectile-blue.png b/img/SPC/Projectiles/projectile-blue.png deleted file mode 100644 index 8a2ceea..0000000 Binary files a/img/SPC/Projectiles/projectile-blue.png and /dev/null differ diff --git a/img/SPC/Projectiles/projectile-green.png b/img/SPC/Projectiles/projectile-green.png deleted file mode 100644 index 3df2af7..0000000 Binary files a/img/SPC/Projectiles/projectile-green.png and /dev/null differ diff --git a/img/SPC/Projectiles/projectile-orange.png b/img/SPC/Projectiles/projectile-orange.png deleted file mode 100644 index 0fb4b8b..0000000 Binary files a/img/SPC/Projectiles/projectile-orange.png and /dev/null differ diff --git a/img/SPC/Projectiles/projectile-red.png b/img/SPC/Projectiles/projectile-red.png deleted file mode 100644 index 11e00d0..0000000 Binary files a/img/SPC/Projectiles/projectile-red.png and /dev/null differ diff --git a/img/SPC/_pixel_spaceships_for_shmup_1.4.psd b/img/SPC/_pixel_spaceships_for_shmup_1.4.psd deleted file mode 100644 index be52be4..0000000 Binary files a/img/SPC/_pixel_spaceships_for_shmup_1.4.psd and /dev/null differ diff --git a/img/SPC/blue_01.png b/img/SPC/blue_01.png deleted file mode 100644 index d97955d..0000000 Binary files a/img/SPC/blue_01.png and /dev/null differ diff --git a/img/SPC/blue_02.png b/img/SPC/blue_02.png deleted file mode 100644 index acaacdc..0000000 Binary files a/img/SPC/blue_02.png and /dev/null differ diff --git a/img/SPC/blue_03.png b/img/SPC/blue_03.png deleted file mode 100644 index fc8373f..0000000 Binary files a/img/SPC/blue_03.png and /dev/null differ diff --git a/img/SPC/blue_04.png b/img/SPC/blue_04.png deleted file mode 100644 index 792e486..0000000 Binary files a/img/SPC/blue_04.png and /dev/null differ diff --git a/img/SPC/blue_05.png b/img/SPC/blue_05.png deleted file mode 100644 index 511533f..0000000 Binary files a/img/SPC/blue_05.png and /dev/null differ diff --git a/img/SPC/blue_06.png b/img/SPC/blue_06.png deleted file mode 100644 index 9c3e953..0000000 Binary files a/img/SPC/blue_06.png and /dev/null differ diff --git a/img/SPC/darkgrey_01.png b/img/SPC/darkgrey_01.png deleted file mode 100644 index e97606d..0000000 Binary files a/img/SPC/darkgrey_01.png and /dev/null differ diff --git a/img/SPC/darkgrey_02.png b/img/SPC/darkgrey_02.png deleted file mode 100644 index 70a59bf..0000000 Binary files a/img/SPC/darkgrey_02.png and /dev/null differ diff --git a/img/SPC/darkgrey_03.png b/img/SPC/darkgrey_03.png deleted file mode 100644 index 6981cf7..0000000 Binary files a/img/SPC/darkgrey_03.png and /dev/null differ diff --git a/img/SPC/darkgrey_04.png b/img/SPC/darkgrey_04.png deleted file mode 100644 index 6e90225..0000000 Binary files a/img/SPC/darkgrey_04.png and /dev/null differ diff --git a/img/SPC/darkgrey_05.png b/img/SPC/darkgrey_05.png deleted file mode 100644 index e3ca544..0000000 Binary files a/img/SPC/darkgrey_05.png and /dev/null differ diff --git a/img/SPC/darkgrey_06.png b/img/SPC/darkgrey_06.png deleted file mode 100644 index d57517d..0000000 Binary files a/img/SPC/darkgrey_06.png and /dev/null differ diff --git a/img/SPC/green_01.png b/img/SPC/green_01.png deleted file mode 100644 index 7d20878..0000000 Binary files a/img/SPC/green_01.png and /dev/null differ diff --git a/img/SPC/green_02.png b/img/SPC/green_02.png deleted file mode 100644 index 1272a84..0000000 Binary files a/img/SPC/green_02.png and /dev/null differ diff --git a/img/SPC/green_03.png b/img/SPC/green_03.png deleted file mode 100644 index 4a21c55..0000000 Binary files a/img/SPC/green_03.png and /dev/null differ diff --git a/img/SPC/green_04.png b/img/SPC/green_04.png deleted file mode 100644 index 368782b..0000000 Binary files a/img/SPC/green_04.png and /dev/null differ diff --git a/img/SPC/green_05.png b/img/SPC/green_05.png deleted file mode 100644 index 5aa6107..0000000 Binary files a/img/SPC/green_05.png and /dev/null differ diff --git a/img/SPC/green_06.png b/img/SPC/green_06.png deleted file mode 100644 index 317a019..0000000 Binary files a/img/SPC/green_06.png and /dev/null differ diff --git a/img/SPC/large_blue_01.png b/img/SPC/large_blue_01.png deleted file mode 100644 index 55d2943..0000000 Binary files a/img/SPC/large_blue_01.png and /dev/null differ diff --git a/img/SPC/large_blue_02.png b/img/SPC/large_blue_02.png deleted file mode 100644 index d263b70..0000000 Binary files a/img/SPC/large_blue_02.png and /dev/null differ diff --git a/img/SPC/large_green_01.png b/img/SPC/large_green_01.png deleted file mode 100644 index e21c913..0000000 Binary files a/img/SPC/large_green_01.png and /dev/null differ diff --git a/img/SPC/large_grey_01.png b/img/SPC/large_grey_01.png deleted file mode 100644 index c11df58..0000000 Binary files a/img/SPC/large_grey_01.png and /dev/null differ diff --git a/img/SPC/large_grey_02.png b/img/SPC/large_grey_02.png deleted file mode 100644 index 2832934..0000000 Binary files a/img/SPC/large_grey_02.png and /dev/null differ diff --git a/img/SPC/large_purple_01.png b/img/SPC/large_purple_01.png deleted file mode 100644 index 4740265..0000000 Binary files a/img/SPC/large_purple_01.png and /dev/null differ diff --git a/img/SPC/large_red_01.png b/img/SPC/large_red_01.png deleted file mode 100644 index 9837352..0000000 Binary files a/img/SPC/large_red_01.png and /dev/null differ diff --git a/img/SPC/metalic_01.png b/img/SPC/metalic_01.png deleted file mode 100644 index 2ad6de9..0000000 Binary files a/img/SPC/metalic_01.png and /dev/null differ diff --git a/img/SPC/metalic_02.png b/img/SPC/metalic_02.png deleted file mode 100644 index d5a4f68..0000000 Binary files a/img/SPC/metalic_02.png and /dev/null differ diff --git a/img/SPC/metalic_03.png b/img/SPC/metalic_03.png deleted file mode 100644 index d694151..0000000 Binary files a/img/SPC/metalic_03.png and /dev/null differ diff --git a/img/SPC/metalic_04.png b/img/SPC/metalic_04.png deleted file mode 100644 index 8cd0d73..0000000 Binary files a/img/SPC/metalic_04.png and /dev/null differ diff --git a/img/SPC/metalic_05.png b/img/SPC/metalic_05.png deleted file mode 100644 index ff5532c..0000000 Binary files a/img/SPC/metalic_05.png and /dev/null differ diff --git a/img/SPC/metalic_06.png b/img/SPC/metalic_06.png deleted file mode 100644 index 47b86b3..0000000 Binary files a/img/SPC/metalic_06.png and /dev/null differ diff --git a/img/SPC/orange_01.png b/img/SPC/orange_01.png deleted file mode 100644 index cfeb138..0000000 Binary files a/img/SPC/orange_01.png and /dev/null differ diff --git a/img/SPC/orange_02.png b/img/SPC/orange_02.png deleted file mode 100644 index e23af41..0000000 Binary files a/img/SPC/orange_02.png and /dev/null differ diff --git a/img/SPC/orange_03.png b/img/SPC/orange_03.png deleted file mode 100644 index 71ee69a..0000000 Binary files a/img/SPC/orange_03.png and /dev/null differ diff --git a/img/SPC/orange_04.png b/img/SPC/orange_04.png deleted file mode 100644 index bac4116..0000000 Binary files a/img/SPC/orange_04.png and /dev/null differ diff --git a/img/SPC/orange_05.png b/img/SPC/orange_05.png deleted file mode 100644 index 5078ed0..0000000 Binary files a/img/SPC/orange_05.png and /dev/null differ diff --git a/img/SPC/orange_06.png b/img/SPC/orange_06.png deleted file mode 100644 index b578d59..0000000 Binary files a/img/SPC/orange_06.png and /dev/null differ diff --git a/img/SPC/purple_01.png b/img/SPC/purple_01.png deleted file mode 100644 index 23743c0..0000000 Binary files a/img/SPC/purple_01.png and /dev/null differ diff --git a/img/SPC/purple_02.png b/img/SPC/purple_02.png deleted file mode 100644 index dfe7e4c..0000000 Binary files a/img/SPC/purple_02.png and /dev/null differ diff --git a/img/SPC/purple_03.png b/img/SPC/purple_03.png deleted file mode 100644 index e95e6cf..0000000 Binary files a/img/SPC/purple_03.png and /dev/null differ diff --git a/img/SPC/purple_04.png b/img/SPC/purple_04.png deleted file mode 100644 index d014b1b..0000000 Binary files a/img/SPC/purple_04.png and /dev/null differ diff --git a/img/SPC/purple_05.png b/img/SPC/purple_05.png deleted file mode 100644 index 552d667..0000000 Binary files a/img/SPC/purple_05.png and /dev/null differ diff --git a/img/SPC/purple_06.png b/img/SPC/purple_06.png deleted file mode 100644 index b4f4ba9..0000000 Binary files a/img/SPC/purple_06.png and /dev/null differ diff --git a/img/SPC/red_01.png b/img/SPC/red_01.png deleted file mode 100644 index b17fb8b..0000000 Binary files a/img/SPC/red_01.png and /dev/null differ diff --git a/img/SPC/red_02.png b/img/SPC/red_02.png deleted file mode 100644 index 27f8c64..0000000 Binary files a/img/SPC/red_02.png and /dev/null differ diff --git a/img/SPC/red_03.png b/img/SPC/red_03.png deleted file mode 100644 index 36edd01..0000000 Binary files a/img/SPC/red_03.png and /dev/null differ diff --git a/img/SPC/red_04.png b/img/SPC/red_04.png deleted file mode 100644 index 07a28d3..0000000 Binary files a/img/SPC/red_04.png and /dev/null differ diff --git a/img/SPC/red_05.png b/img/SPC/red_05.png deleted file mode 100644 index f70a7f7..0000000 Binary files a/img/SPC/red_05.png and /dev/null differ diff --git a/img/SPC/red_06.png b/img/SPC/red_06.png deleted file mode 100644 index eb06a4a..0000000 Binary files a/img/SPC/red_06.png and /dev/null differ diff --git a/img/SPC/tankbase_01.png b/img/SPC/tankbase_01.png deleted file mode 100644 index 00a4af9..0000000 Binary files a/img/SPC/tankbase_01.png and /dev/null differ diff --git a/img/SPC/tankbase_02.png b/img/SPC/tankbase_02.png deleted file mode 100644 index a002b9b..0000000 Binary files a/img/SPC/tankbase_02.png and /dev/null differ diff --git a/img/SPC/tankbase_03.png b/img/SPC/tankbase_03.png deleted file mode 100644 index b89468e..0000000 Binary files a/img/SPC/tankbase_03.png and /dev/null differ diff --git a/img/SPC/tankbase_04.png b/img/SPC/tankbase_04.png deleted file mode 100644 index de9986f..0000000 Binary files a/img/SPC/tankbase_04.png and /dev/null differ diff --git a/img/SPC/tankbase_05.png b/img/SPC/tankbase_05.png deleted file mode 100644 index b4e71ad..0000000 Binary files a/img/SPC/tankbase_05.png and /dev/null differ diff --git a/img/SPC/tankcannon-01a.png b/img/SPC/tankcannon-01a.png deleted file mode 100644 index 5fd70c1..0000000 Binary files a/img/SPC/tankcannon-01a.png and /dev/null differ diff --git a/img/SPC/tankcannon-01b.png b/img/SPC/tankcannon-01b.png deleted file mode 100644 index b3bb410..0000000 Binary files a/img/SPC/tankcannon-01b.png and /dev/null differ diff --git a/img/SPC/tankcannon-02a.png b/img/SPC/tankcannon-02a.png deleted file mode 100644 index 13d7dc9..0000000 Binary files a/img/SPC/tankcannon-02a.png and /dev/null differ diff --git a/img/SPC/tankcannon-02b.png b/img/SPC/tankcannon-02b.png deleted file mode 100644 index abcbb43..0000000 Binary files a/img/SPC/tankcannon-02b.png and /dev/null differ diff --git a/img/SPC/tankcannon-03a.png b/img/SPC/tankcannon-03a.png deleted file mode 100644 index 9662f96..0000000 Binary files a/img/SPC/tankcannon-03a.png and /dev/null differ diff --git a/img/SPC/tankcannon-03b.png b/img/SPC/tankcannon-03b.png deleted file mode 100644 index bc6435f..0000000 Binary files a/img/SPC/tankcannon-03b.png and /dev/null differ diff --git a/img/large_grey_01.png b/img/large_grey_01.png deleted file mode 100644 index c11df58..0000000 Binary files a/img/large_grey_01.png and /dev/null differ diff --git a/img/large_red_01.png b/img/large_red_01.png deleted file mode 100644 index 9837352..0000000 Binary files a/img/large_red_01.png and /dev/null differ diff --git a/img/tankbase_05.png b/img/tankbase_05.png deleted file mode 100644 index b4e71ad..0000000 Binary files a/img/tankbase_05.png and /dev/null differ diff --git a/img/tankcannon-02a.png b/img/tankcannon-02a.png deleted file mode 100644 index 13d7dc9..0000000 Binary files a/img/tankcannon-02a.png and /dev/null differ diff --git a/img/tankcannon-03a.png b/img/tankcannon-03a.png deleted file mode 100644 index 9662f96..0000000 Binary files a/img/tankcannon-03a.png and /dev/null differ diff --git a/main.lua b/main.lua index 4a61ecb..f1b4398 100644 --- a/main.lua +++ b/main.lua @@ -25,9 +25,10 @@ showTouchControls = false --0.9 VARIABLES +isButtonAnimated = false + wallsLoadError = false background = love.graphics.newImage('img/background.jpg') -bigship = love.graphics.newImage('img/large_red_01.png') backgroundScroll = 0 background_scroll_speed = 10 @@ -125,20 +126,22 @@ function newTouch(id, x, y) originalY = y } end -function newButton(text, fn, sp) - if sp ~= nil then +function newButton(text, fn, sp, qp) + if qp ~= nil then return { x = (VIRTUAL_WIDTH * 0.5) - VIRTUAL_WIDTH * (1/3)*0.5, text = text, fn = fn, + skipAnim = true, now = false, last = false } else return { - x = 1290, + x = 1300, text = text, fn = fn, + skipAnim = sp, now = false, last = false } @@ -189,7 +192,6 @@ controlSettings = {} modeSelectorButtons = {} pracdiff = {} playerCountButtons = {} -ships = {} function controlChanger() if (gameState == "assign") then love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255) @@ -198,7 +200,8 @@ function controlChanger() end function love.load() walls = {} - love.filesystem.createDirectory( "pong" ) + print(love.filesystem.createDirectory( "pong" )) + love.filesystem.setIdentity( "pong" ) print (love.filesystem.getSaveDirectory()) print (love.filesystem.getIdentity( )) love.graphics.setDefaultFilter('nearest', 'nearest') @@ -242,7 +245,8 @@ function love.load() globalState = "menu" hardmanager() end - end + end, + false ) ) table.insert( @@ -253,7 +257,8 @@ function love.load() for k in pairs(walls) do walls[k] = nil end - end + end, + false ) ) table.insert( @@ -263,7 +268,8 @@ function love.load() function() paused = false TEXT = "Let's Continue" - end + end, + false ) ) table.insert( @@ -287,7 +293,8 @@ function love.load() potentialstrike2 = 0 player1nukescore = 0 player2nukescore = 0 - end + end, + false ) ) table.insert( @@ -304,7 +311,8 @@ function love.load() ball[1].dy = 1 globalState = "menu" hardmanager() - end + end, + false ) ) if not isAndroid then @@ -318,7 +326,8 @@ function love.load() DIFFERENCE_Y = myscreen.d OFFSET_X = myscreen.e OFFSET_Y = myscreen.f - end + end, + true ) ) end @@ -332,7 +341,8 @@ function love.load() else musicController("mute", 1) end - end + end, + true ) ) table.insert( @@ -349,7 +359,8 @@ function love.load() ball[1].dy = 1 globalState = "menu" hardmanager() - end + end, + false ) ) @@ -358,8 +369,9 @@ function love.load() newButton( "S", function() - love.filesystem.write("save.lua", serialize(walls)) - end + print(love.filesystem.write("save.lua", serialize(walls))) + end, + true ) ) table.insert( @@ -372,7 +384,8 @@ function love.load() walls = {} wallsLoadError = true end - end + end, + true ) ) table.insert( @@ -382,7 +395,8 @@ function love.load() function() ptw = 10 gameState = "gameMode" - end + end, + false ) ) table.insert( @@ -395,7 +409,8 @@ function love.load() love.keyboard.setTextInput( true, 0, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT/3) end gameState = "chooseIP" - end + end, + false ) ) table.insert( @@ -407,7 +422,8 @@ function love.load() AGAINST_AI = 0 gameState = "1serve" ball[1]:reset(1, 1) - end + end, + true ) ) table.insert( @@ -419,7 +435,8 @@ function love.load() AGAINST_AI = 0 gameState = "1serve" ball[1]:reset(1, 1) - end + end, + true ) ) table.insert( @@ -428,7 +445,8 @@ function love.load() "Multiplayer", function() gameState = "multiMode" - end + end, + false ) ) if not isAndroid then @@ -439,7 +457,8 @@ function love.load() function() AGAINST_AI = 0 gameState = "windowsettings" - end + end, + false ) ) else @@ -454,7 +473,8 @@ function love.load() showTouchControls = true end gameState = "touchcontrols" - end + end, + true ) ) end @@ -464,7 +484,8 @@ function love.load() "Exit", function() love.event.quit(0) - end + end, + false ) ) table.insert( @@ -473,7 +494,8 @@ function love.load() "Easy", function() hardmanager("easy") - end + end, + false ) ) table.insert( @@ -482,7 +504,8 @@ function love.load() "Normal", function() hardmanager("normal") - end + end, + false ) ) table.insert( @@ -491,7 +514,8 @@ function love.load() "Hard", function() hardmanager("hard") - end + end, + false ) ) table.insert( @@ -500,7 +524,8 @@ function love.load() "Smart", function() hardmanager("smart") - end + end, + false ) ) --table.insert( @@ -522,7 +547,8 @@ function love.load() DIFFERENCE_Y = myscreen.d OFFSET_X = myscreen.e OFFSET_Y = myscreen.f - end + end, + true ) ) if isAndroid then @@ -536,7 +562,8 @@ function love.load() else musicController("mute", 1) end - end + end, + true ) ) end @@ -550,7 +577,8 @@ function love.load() else musicController("mute", 1) end - end + end, + true ) ) table.insert( @@ -559,7 +587,8 @@ function love.load() "Editor", function() gameState = "editor" - end + end, + true ) ) table.insert( @@ -568,7 +597,8 @@ function love.load() "Speed Settings", function() gameState = "speedSettings" - end + end, + true ) ) table.insert( @@ -577,7 +607,8 @@ function love.load() "Control Settings", function() gameState = "controlSettings" - end + end, + false ) ) table.insert( @@ -586,7 +617,8 @@ function love.load() "Back to Menu", function() gameState = "menu" - end + end, + false ) ) table.insert( @@ -595,7 +627,8 @@ function love.load() "Back to Menu", function() gameState = "windowsettings" - end + end, + false ) ) --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end)) @@ -605,7 +638,8 @@ function love.load() "Ball Speed: ", function() speedSetter("ball") - end + end, + true ) ) --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end)) @@ -615,7 +649,8 @@ function love.load() "snc", function() speedSetter("snc") - end + end, + true ) ) table.insert( @@ -624,7 +659,8 @@ function love.load() "NUCLEAR MODE", function() speedSetter("nuclearmod") - end + end, + true ) ) table.insert( @@ -634,7 +670,8 @@ function love.load() function() gameState = "assign" req = "p1up" - end + end, + true ) ) table.insert( @@ -644,7 +681,8 @@ function love.load() function() gameState = "assign" req = "p1down" - end + end, + true ) ) table.insert( @@ -654,7 +692,8 @@ function love.load() function() gameState = "assign" req = "p1super" - end + end, + true ) ) table.insert( @@ -664,7 +703,8 @@ function love.load() function() gameState = "assign" req = "p1ct" - end + end, + true ) ) table.insert( @@ -674,7 +714,8 @@ function love.load() function() gameState = "assign" req = "p2up" - end + end, + true ) ) table.insert( @@ -684,7 +725,8 @@ function love.load() function() gameState = "assign" req = "p2down" - end + end, + true ) ) table.insert( @@ -694,7 +736,8 @@ function love.load() function() gameState = "assign" req = "p2super" - end + end, + true ) ) table.insert( @@ -704,7 +747,8 @@ function love.load() function() gameState = "assign" req = "p2ct" - end + end, + true ) ) table.insert( @@ -714,7 +758,8 @@ function love.load() function() p1control = {up = "a", down = "z", super = "s", counter = "x"} p2control = {up = ";", down = ".", super = "l", counter = ","} - end + end, + true ) ) table.insert( @@ -723,7 +768,8 @@ function love.load() "Return", function() gameState = "windowsettings" - end + end, + false ) ) table.insert( @@ -732,7 +778,8 @@ function love.load() "Nuclear Pong", function() gameState = "difficulty" - end + end, + false ) ) table.insert( @@ -741,7 +788,8 @@ function love.load() "Main Menu", function() gameState = "menu" - end + end, + false ) ) table.insert( @@ -750,7 +798,8 @@ function love.load() "Silverblade", function() speedSetter("practice") - end + end, + false ) ) table.insert( @@ -760,7 +809,8 @@ function love.load() function() speedSetter("reset") gameState = "gameMode" - end + end, + false ) ) table.insert( @@ -770,7 +820,8 @@ function love.load() function() gameMode = "practice" hardmanager("practice") - end + end, + false ) ) --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end)) @@ -780,7 +831,8 @@ function love.load() "ballCount", function() speedSetter("ballz") - end + end, + true ) ) table.insert( @@ -789,7 +841,8 @@ function love.load() "ballCount", function() speedSetter("ballz") - end + end, + true ) ) table.insert( @@ -800,7 +853,8 @@ function love.load() speedSetter("reset") gameState = "menu" - end + end, + false ) ) table.insert( @@ -809,7 +863,8 @@ function love.load() "ptw", function() speedSetter("ptw") - end + end, + true ) ) table.insert( @@ -820,7 +875,8 @@ function love.load() AGAINST_AI = 0 gameState = "1serve" globalState = "base" - end + end, + false ) ) table.insert( @@ -831,7 +887,8 @@ function love.load() gameState = "1serve" gameMode = "reversegame" globalState = "base" - end + end, + false ) ) @@ -2438,7 +2495,7 @@ end function resetButtonX(arr) for i, buttons in ipairs(arr) do - buttons.x = 1290 + buttons.x = 1300 end end diff --git a/main2.lua b/main2.lua deleted file mode 100644 index ebfdfdd..0000000 --- a/main2.lua +++ /dev/null @@ -1,1432 +0,0 @@ ---CALLING OTHER LUA FILES -require "src/dependencies" -io.stdout:setvbuf("no") ---CANCELLED ATTEMPETED SHADING (NOT WORKING) -local shader_code = - [[ -vec4 effect(vec4 color, Image image, vec2 uvs, vec2 screen_coords) { - vec4 pixel = Texel(image,uvs); - return pixel * color; -} -]] - -debug = true ---GLOBAL VARIABLES -gameMode = "normal" -globalState = "menu" -timeIsSlow = false -timeIsSlow2 = false -originalSpeed = 200 -explosionRange = 0 -blockinput = false -wall1width = 30 -nuclearanimation = 3 -easternum = 0 -ball_DIR = 0 -RED = 255 -hitNum = {} -hitNum[1] = 0 -hitNum[2] = 0 -hitNum[3] = 0 -confirmation = "disconnected" -hitNum[4] = 0 -p1bonus = 0 -p2bonus = 0 -hitNum[5] = 0 -hitNum[6] = 0 -GREEN = 255 -BLUE = 255 -updateTEXT = "Chalkboard Update" -maxBalls = 1 -playerCount = 1 -player1reverbav = 0 -playertext = "1v1" -player2reverbav = 0 -elapsed = 0 -rotation = 0 -TEXT = "Nuclear Pong" -currentKey = " " -ptw = 10 - ---CHECKING IF CONTROLS ARE TAKEN -danger = "none" -danger2 = "none" - -nuckemodactive = 0 -maxspeed = 700 -DIFFERENCE_X = 1 -DIFFERENCE_Y = 1 -paddle_SPEED = 20 -textamount = 15 -AI_STRIKEMOD = 1000 -resolutionWin = 0 -AGAINST_AI = 0 -RESOLUTION_SET = 0 -AI_NUKEMOD = 1000 -animstart = true -AI_SPEED = 30 -craz = 0 -AI_LEVEL = 500 -isFullscreen = 0 -prtext = "Easy" -lastSentKey = "c" -MAP_TYPE = 0 -lastSentKeyClient = "c" -difficultyl = 300 -req = "pp" -ballSet = 200 -p1control = {up = "a", down = "z", super = "s", counter = "x"} -p2control = {up = ";", down = ".", super = "l", counter = ","} -synctext = "Independent" -synctype = 0 -function newButton(text, fn) - return { - text = text, - fn = fn, - now = false, - last = false - } -end -function love.keyboard.mouseWasReleased() - return love.keyboard.mouseisReleased -end -function autoSave(dt) - autoTimer = autoTimer + dt -end - -function balancer() - if (player2score == 9 or player1score == 9) then - shakeDuration = 5 - if debug then - --print("Shaking set to match almost over") - end - end - if (player1score < player2score) then - p1bonus = (player2score - player1score) * 5 - else - p1bonus = 0 - end - if (player2score < player1score) then - p2bonus = (player1score - player2score) * 5 - else - p2bonus = 0 - end -end - -function newWall(wallx, wally, wallwidth, wallheight) - return { - wallx = wallx, - wally = wally, - walwidth = wallwidth, - wallheight = wallheight - } -end -speedParameters = {} -buttons = {} -difbuttons = {} -settings = {} -walls = {} -editorpicks = {} -controlSettings = {} -modeSelectorButtons = {} -pracdiff = {} -playerCountButtons = {} -function controlChanger() - if (gameState == "assign") then - love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255) - love.graphics.printf("SELECT BUTTON", 0, VIRTUAL_HEIGHT / 2, VIRTUAL_WIDTH, "center") - end -end -function love.load() - simpleScale.setWindow(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT) - configfile = io.open("config.lua", "r") - configsave = io.open("config.lua", "w") - shader = love.graphics.newShader(shader_code) - time_1 = 0 - --print("Debug active") - --load - - testwalls = love.filesystem.load("save.lua")() - if testwalls ~= nil then - walls = love.filesystem.load("save.lua")() - end - - light = 0 - image = love.graphics.newImage("Madi.png") - table.insert( - editorpicks, - newButton( - "C", - function() - for k in pairs(walls) do - walls[k] = nil - end - end - ) - ) - table.insert( - editorpicks, - newButton( - "S", - function() - love.filesystem.write("save.lua", serialize(walls)) - end - ) - ) - table.insert( - editorpicks, - newButton( - "L", - function() - walls = love.filesystem.load("save.lua")() - end - ) - ) - table.insert( - buttons, - newButton( - "Singleplayer", - function() - gameState = "gameMode" - end - ) - ) - table.insert( - buttons, - newButton( - "Online Test", - function() - globalState = "nettest" - AGAINST_AI = 0 - gameState = "1serve" - end - ) - ) - table.insert( - buttons, - newButton( - "Client Test", - function() - globalState = "clienttest" - AGAINST_AI = 0 - gameState = "1serve" - end - ) - ) - table.insert( - buttons, - newButton( - "Multiplayer", - function() - gameState = "multiMode" - end - ) - ) - table.insert( - buttons, - newButton( - "Settings", - function() - AGAINST_AI = 0 - gameState = "windowsettings" - end - ) - ) - table.insert( - buttons, - newButton( - "Exit", - function() - love.event.quit(0) - end - ) - ) - table.insert( - difbuttons, - newButton( - "Easy", - function() - hardmanager("easy") - end - ) - ) - table.insert( - difbuttons, - newButton( - "Normal", - function() - hardmanager("normal") - end - ) - ) - table.insert( - difbuttons, - newButton( - "Hard", - function() - hardmanager("hard") - end - ) - ) - table.insert( - difbuttons, - newButton( - "Smart", - function() - hardmanager("smart") - end - ) - ) - table.insert( - settings, - newButton( - "Change Map", - function() - MAP_TYPE = MAP_TYPE + 1 - end - ) - ) - table.insert( - settings, - newButton( - "Toggle Fullscreen", - function() - myscreen:toggle(VIRTUAL_HEIGHT, VIRTUAL_WIDTH) - DIFFERENCE_X = myscreen.c - DIFFERENCE_Y = myscreen.d - end - ) - ) - table.insert( - settings, - newButton( - "Editor", - function() - gameState = "editor" - end - ) - ) - table.insert( - settings, - newButton( - "Speed Settings", - function() - gameState = "speedSettings" - end - ) - ) - table.insert( - settings, - newButton( - "Control Settings", - function() - gameState = "controlSettings" - end - ) - ) - table.insert( - settings, - newButton( - "Back to Menu", - function() - gameState = "menu" - end - ) - ) - table.insert( - speedParameters, - newButton( - "Back to Menu", - function() - gameState = "windowsettings" - end - ) - ) - --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end)) - table.insert( - playerCountButtons, - newButton( - "Ball Speed: ", - function() - speedSetter("ball") - end - ) - ) - --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end)) - table.insert( - playerCountButtons, - newButton( - "snc", - function() - speedSetter("snc") - end - ) - ) - table.insert( - speedParameters, - newButton( - "NUCLEAR MODE", - function() - speedSetter("nuclearmod") - end - ) - ) - table.insert( - controlSettings, - newButton( - "1up", - function() - gameState = "assign" - req = "p1up" - end - ) - ) - table.insert( - controlSettings, - newButton( - "1down", - function() - gameState = "assign" - req = "p1down" - end - ) - ) - table.insert( - controlSettings, - newButton( - "1special", - function() - gameState = "assign" - req = "p1super" - end - ) - ) - table.insert( - controlSettings, - newButton( - "1ct", - function() - gameState = "assign" - req = "p1ct" - end - ) - ) - table.insert( - controlSettings, - newButton( - "2up", - function() - gameState = "assign" - req = "p2up" - end - ) - ) - table.insert( - controlSettings, - newButton( - "2down", - function() - gameState = "assign" - req = "p2down" - end - ) - ) - table.insert( - controlSettings, - newButton( - "2special", - function() - gameState = "assign" - req = "p2super" - end - ) - ) - table.insert( - controlSettings, - newButton( - "2ct", - function() - gameState = "assign" - req = "p2ct" - end - ) - ) - table.insert( - controlSettings, - newButton( - "Default", - function() - p1control = {up = "a", down = "z", super = "s", counter = "x"} - p2control = {up = ";", down = ".", super = "l", counter = ","} - end - ) - ) - table.insert( - controlSettings, - newButton( - "Return", - function() - gameState = "windowsettings" - end - ) - ) - table.insert( - modeSelectorButtons, - newButton( - "Nuclear Pong", - function() - gameState = "difficulty" - end - ) - ) - table.insert( - modeSelectorButtons, - newButton( - "Main Menu", - function() - gameState = "menu" - end - ) - ) - table.insert( - pracdiff, - newButton( - "Silverblade", - function() - speedSetter("practice") - end - ) - ) - table.insert( - pracdiff, - newButton( - "Return", - function() - speedSetter("reset") - gameState = "gameMode" - end - ) - ) - table.insert( - pracdiff, - newButton( - "Go!", - function() - gameMode = "practice" - hardmanager("practice") - end - ) - ) - --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end)) - table.insert( - playerCountButtons, - newButton( - "ballCount", - function() - speedSetter("ballz") - end - ) - ) - table.insert( - difbuttons, - newButton( - "ballCount", - function() - speedSetter("ballz") - end - ) - ) - table.insert( - playerCountButtons, - newButton( - "Return", - function() - speedSetter("reset") - gameState = "menu" - - end - ) - ) - table.insert( - playerCountButtons, - newButton( - "ptw", - function() - speedSetter("ptw") - end - ) - ) - table.insert( - playerCountButtons, - newButton( - "Play", - function() - AGAINST_AI = 0 - gameState = "1serve" - globalState = "base" - end - ) - ) - table.insert( - playerCountButtons, - newButton( - "Reverse Play", - function() - gameState = "1serve" - gameMode = "reversegame" - end - ) - ) - - --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter() end)) - - love.window.setTitle("NUCLEAR PONG") - textphrases = { - "Amazing", - "Superb", - "Absolutely beautiful!", - "Awesome", - "Look at That!", - "Great", - "Nice", - "Boom!", - "Dangerous!", - "Astonishing!", - "u/ebernerd saved me", - "Absolutely Wonderful!", - "Exsquisite", - "Delicate", - "Pow!", - "Great Hit", - "all hail nazarbayev" - } - sounds = { - ["updateMusic"] = love.audio.newSource("audio/theme1.mp3", "static"), - ["gayTheme"] = love.audio.newSource("audio/theme2.mp3", "static"), - ["gayTheme2"] = love.audio.newSource("audio/theme3.mp3", "static"), - ["gayTheme3"] = love.audio.newSource("audio/theme4.mp3", "static"), - ["beep"] = love.audio.newSource("audio/hit1.mp3", "static"), - ["wallhit"] = love.audio.newSource("audio/hit2.wav", "static"), - ["win"] = love.audio.newSource("win.wav", "static"), - ["score"] = love.audio.newSource("audio/score.wav", "static"), - ["nuke"] = love.audio.newSource("audio/bomb.wav", "static"), - ["striking"] = love.audio.newSource("audio/superhit.wav", "static"), - ["nuclearhit"] = love.audio.newSource("audio/hit1.mp3", "static"), - ["time"] = love.audio.newSource("audio/time.wav", "static") - } - love.graphics.setDefaultFilter("nearest", "nearest") - --comic sans lmao - math.randomseed(os.time()) - smallfont = love.graphics.newFont("font.ttf", 25) - scorefont = love.graphics.newFont("font.ttf", 60) - love.graphics.setFont(smallfont) - - --push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, { - -- fullscreen = isFullscreen, - -- resizable = true, - -- vsync = true, - --}) - player1score = 0 - player2score = 0 - areanuclear = 0 - player1nukescore = 0 - player2nukescore = 0 - striken = 0 - soundtype = 1 - soundturn = 1 - potentialstrike1 = 0 - potentialstrike2 = 0 - potentialnuke1 = 0 - potentialnuke2 = 0 - player1striken = 0 - player2striken = 0 - randomtext = 0 - selecting = 0 - number = 0 - elec = 1 - INDIC = { - "", - "", - "", - "" - } - --playe1nuke - player1 = paddle(0, 30, 10, 100, 1) - player2 = paddle(VIRTUAL_WIDTH * 0.99, VIRTUAL_HEIGHT * 0.88, 10, 100, 2) - player3 = paddle(5000, 5000, 10, 100) - player4 = paddle(5000, 5000, 10, 100) - ball = {} - ball[1] = eball(VIRTUAL_WIDTH / 2, VIRTUAL_HEIGHT / 2 - 2, 16, 16) - ball[2] = eball(VIRTUAL_WIDTH / 1.9, VIRTUAL_HEIGHT / 2 - 2, 16, 16) - ball[3] = eball(VIRTUAL_WIDTH / 1.8, VIRTUAL_HEIGHT / 2 - 2, 16, 16) - ball[4] = eball(VIRTUAL_WIDTH / 2.2, VIRTUAL_HEIGHT / 2 - 2, 16, 16) - ball[5] = eball(VIRTUAL_WIDTH / 2.1, VIRTUAL_HEIGHT / 2 - 2, 16, 16) - myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y) - mymenu = mainMenu() - - ballSpeed = 200 - - ballDX = math.random(2) == 1 and 100 or -100 - ballDY = math.random(-50, 50) - - gameState = "animation" -end -t = 0 -shakeDuration = 0 -shakeMagnitude = 1 -function startShake(duration, magnitude) - t, shakeDuration, shakeMagnitude = 0, duration or 1, magnitude or 5 -end -function displayFPS() - --love.window.setTitle(love.timer.getFPS()) - love.window.setTitle(globalState .. " " .. gameState) - if love.keyboard.isDown("space") then - player1nukescore = 200 - player1score = player1score + 0.2 - player2nukescore = 200 - end - -end - -function speedControl() - if (ballSpeed > maxspeed and gameState == "play") then - ballSpeed = maxspeed - end -end - -function love.update(dt) - print("IMPORTANT!!!!!" .. globalState .. gameState) - staticanimatorcounter(dt) - musicController('norm', 1) - if debug then - displayFPS() - end - if globalState == "base" then - basegame(dt) - end - if globalState == "menu" then - debugCheck(dt) - end - if globalState == "nettest" then - basegame(dt) - nettest(dt) - end - if globalState == "clienttest" then - if confirmation ~= "disconnected" then - lastSentKeyP1 = lastSentKeyClient - clientsBaseGame(dt) - end - clienttest(dt) - end -end -serverinit = false -clientinit = false -function nettest(dt) - if serverinit == false then - local socket = require('socket') - udp = socket.udp() - udp:setsockname('*', 12345) - udp:settimeout(0) - serverinit = true - end - data, msg_or_ip, port_or_nil = udp:receivefrom() - if data then - print(data .. "FROM " .. msg_or_ip) - end - if data then - local p = split(data, '|') - lastSentKeyClient = p[1] - for i = 1, maxBalls do - print (tostring(ball[i].dy)) - udp:sendto(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), msg_or_ip, port_or_nil) - print("SENT: " .. lastSentKey) - end - end -end -function clienttest(dt) - if clientinit == false then - local socket = require "socket" - local address, port = "127.0.0.1", 12345 - udp = socket.udp() - udp:setpeername(address, port) - udp:settimeout(0) - clientinit = true - end - udp:send(tostring(lastSentKey)) - print("SENT TO SERVER:" .. lastSentKey) - data = udp:receive() - --print(data) - if data then - local p = split(data, '|') - for i = 1, maxBalls do - local die = tonumber(p[2]) - print(p[2]) - print(p[2] + 0) - print(tonumber(p[11])) - lastSentKeyClient, ball[i].dy, player2.y, player1.y, player1score, player2score, player1nukescore, player2nukescore, confirmation, ball[i].x, ball[i].y = 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]) - end - else - confirmation = "disconnected" - end - print(confirmation .. " recieved " .. lastSentKeyClient .. " AND ") - -end -function wallbreaker(x, y) - if (gameState == "editor") then - for i, wall in ipairs(walls) do - if math.abs(wall.wallx - x) < 10 and math.abs(wall.wally - y) < 10 then - table.remove(walls, i) - end - end - end -end - -function hardmanager(diff) - selecting = 1 - if (diff == "easy") then - INDIC[1] = ">" - AGAINST_AI = 1 - AI_SPEED = ballSet / 10 - AI_STRIKEMOD = 100 - AI_NUKEMOD = 1000 - AI_LEVEL = 350 - difficultyl = 200 - selecting = 0 - gameState = "1serve" - globalState = "base" - end - if (diff == "normal") then - INDIC[2] = ">" - AI_SPEED = ballSet / 10 - AI_LEVEL = 500 - AI_NUKEMOD = 250 - AI_STRIKEMOD = 60 - AGAINST_AI = 1 - difficultyl = 300 - selecting = 0 - gameState = "1serve" - globalState = "base" - end - if (diff == "hard") then - INDIC[3] = ">" - AI_SPEED = ballSpeed * 1.1 + 50 - AI_SPEED = AI_SPEED / 10 - AI_LEVEL = 700 - AI_NUKEMOD = 200 - AI_STRIKEMOD = 20 - selecting = 0 - difficultyl = 350 - AGAINST_AI = 1 - gameState = "1serve" - globalState = "base" - end - if (diff == "smart") then - INDIC[3] = ">" - AI_SPEED = ballSpeed * 1.1 + 50 - AI_SPEED = AI_SPEED / 10 - AI_LEVEL = 1500 - AI_NUKEMOD = 200 - AI_STRIKEMOD = 20 - selecting = 0 - difficultyl = 350 - AGAINST_AI = 1 - gameState = "1serve" - globalState = "base" - end - if (diff == "practice") then - INDIC[3] = ">" - AI_SPEED = ballSpeed * 500 + 50 - AI_SPEED = AI_SPEED / 10 - AI_LEVEL = 700 - AI_NUKEMOD = 9000000000 - AI_STRIKEMOD = 90000000 - selecting = 0 - difficultyl = 350 - AGAINST_AI = 1 - gameState = "base" - end -end - -function dangerChecker() --CHECK IF CONTROLS ARE DUPLICATING - if (p1control.up == p1control.down) then - danger = "1up" - danger2 = "1down" - elseif (p1control.up == p1control.super) then - danger = "1up" - danger2 = "1special" - elseif (p1control.up == p1control.counter) then - danger = "1up" - danger2 = "1ct" - elseif (p1control.down == p1control.super) then - danger = "1down" - danger2 = "1special" - elseif (p1control.down == p1control.counter) then - danger = "1ct" - danger2 = "1down" - elseif (p1control.super == p1control.counter) then - danger = "1special" - danger2 = "1ct" - elseif (p2control.down == p2control.up) then - danger = "2down" - danger2 = "2up" - elseif (p2control.down == p2control.super) then - danger = "2down" - danger2 = "2special" - elseif (p2control.down == p2control.counter) then - danger = "2down" - danger2 = "2ct" - elseif (p2control.up == p2control.super) then - danger = "2up" - danger2 = "2special" - elseif (p2control.up == p2control.counter) then - danger = "2ct" - danger2 = "2up" - elseif (p2control.super == p2control.counter) then - danger = "2special" - danger2 = "2ct" - else - danger = "none" - danger2 = "none" - end -end -function love.keypressed(key) - lastSentKey = key - if gameState == "assign" then - if (req == "p1up") then - p1control.up = key - currentKey = key - --love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p2up") then - p2control.up = key - currentKey = key - --love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p1down") then - p1control.down = key - currentKey = key - --love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p2down") then - p2control.down = key - currentKey = key - -- love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p1super") then - p1control.super = key - currentKey = key - -- love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p2super") then - p2control.super = key - currentKey = key - -- love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p1ct") then - p1control.counter = key - currentKey = key - -- love.window.setTitle(key) - gameState = "controlSettings" - end - if (req == "p2ct") then - p2control.counter = key - currentKey = key - --love.window.setTitle(key) - gameState = "controlSettings" - end - end - if key == "escape" then - TEXT = "Escape Key" - love.event.quit() - elseif key == "enter" or key == "return" then - if gameState == "start" then - resettinggenius() - gameState = "menu" - globalState = "menu" - hardmanager() - elseif (gameState == "done") then - if (player1score > player2score) then - gameState = "2serve" - potentialnuke1 = 0 - potentialnuke2 = 0 - striken = 0 - if (nuckemodactive == 0) then - areanuclear = 0 - nuclearanimation = 3 - end - potentialstrike1 = 0 - potentialstrike2 = 0 - player1nukescore = 0 - player2nukescore = 0 - else - gameState = "1serve" - resettinggenius() - for i = 1, maxBalls do - ball[i]:reset(i) - end - end - else - gameState = "menu" - globalState = "menu" - if (love.math.random(0, 10) == 1) then - TEXT = "Nuclear Ching Chong" - else - TEXT = "Nuclear Pong" - end - resettinggenius() - for i = 1, maxBalls do - ball[i]:reset(i) - end - end - end -end - -function love.keyreleased(key) - currentKey = " " - if lastSentKey == key then - lastSentKey = "g" - end -end -function speedSetter(requesttype) - if (requesttype == "ball") then - if (ballSet > 550) then - ballSet = 0 - paddle_SPEED = 0 - else - ballSet = ballSet + 50 - paddle_SPEED = paddle_SPEED + 5 - end - ballSpeed = ballSet - end - if (requesttype == "snc") then - synctype = synctype + 1 - if (synctype > 1) then - synctype = 0 - end - - if synctype == 0 then - synctext = "Independent" - end - if synctype == 1 then - synctext = "Synchronised" - end - end - if (requesttype == "nuclearmod") then - nuckemodactive = nuckemodactive + 1 - if (nuckemodactive > 1) then - nuckemodactive = 0 - end - if (nuckemodactive == 0) then - areanuclear = 0 - nuclearanimation = 3 - ballSet = 200 - TEXT = "Nuclear Pong" - - synctype = 0 - maxspeed = 700 - synctext = "Independent" - paddle_SPEED = ballSet / 10 - AI_SPEED = ballSet / 10 - end - if (nuckemodactive == 1) then - areanuclear = 1 - ballSet = 2000 - maxspeed = 2000 - paddle_SPEED = ballSet / 10 - AI_SPEED = ballSet / 10 - synctext = "death is imminent" - end - ballSpeed = ballSet - end - if (requesttype == "practice") then - if (ballSpeed > 999) then - ballSpeed = 200 - ballSet = 200 - end - if (ballSpeed > 799) then - prtext = "Insane" - maxBalls = 5 - elseif ballSpeed > 599 then - prtext = "Hard" - maxBalls = 4 - elseif ballSpeed > 399 then - prtext = "Normal" - maxBalls = 3 - elseif ballSpeed > 199 then - prtext = "Easy" - maxBalls = 3 - end - ballSpeed = ballSpeed + 200 - ballSet = ballSet + 200 - end - if (requesttype == "reset") then - ballSpeed = 200 - ballSet = 200 - synctype = 0 - prtext = "Easy" - maxBalls = 1 - end - if (requesttype == "pc") then - if (playerCount == 2) then - playerCount = 1 - playertext = "1v1" - elseif (playerCount == 1) then - playerCount = playerCount + 1 - player3.x = player1.x + VIRTUAL_WIDTH / 2 - player3.y = player3.y - playertext = "2v2" - end - end - if (requesttype == "ballz") then - if (maxBalls > 1) then - --love.window.setTitle("more than 4") - maxBalls = 1 - else - maxBalls = maxBalls + 1 - end - end - if requesttype == "ptw" then - if ptw == 10 then - ptw = 1 - else - ptw = ptw + 1 - end - end -end - -function gameModeChanger() - if (gameState == "gameMode") then - local button_width = VIRTUAL_WIDTH * (1 / 3) - local BUTTON_HEIGHT = 50 - local margin = 20 - local hot = false - local cursor_y = 0 - local total_height = (BUTTON_HEIGHT + margin) * #buttons - for i, button in ipairs(modeSelectorButtons) do - button.last = button.now - local bx = (VIRTUAL_WIDTH * 0.5) - (button_width * 0.5) - local by = (VIRTUAL_HEIGHT * 0.5) - (total_height * 0.5) + cursor_y - local color = {255, 255, 255, 255} - local mx, my = love.mouse.getPosition() - mx = mx * DIFFERENCE_X - my = my * DIFFERENCE_Y - hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i - if (hot == i) then - color = {10, 10, 0, 255} - end - button.now = love.mouse.isDown(1) - if button.now and not button.last and hot == i then - love.graphics.setColor(0, 0, 0, 1) - love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) - sounds["wallhit"]:play() - button.fn() - end - love.graphics.setColor(unpack(color)) - love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT) - love.graphics.setColor(0, 0, 0, 255) - local textW = smallfont:getWidth(button.text) - local textH = smallfont:getHeight(button.text) - love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5) - love.graphics.setColor(255, 255, 255, 255) - cursor_y = cursor_y + (BUTTON_HEIGHT + margin) - end - end - if (gameState == "multiMode") then - local button_width = VIRTUAL_WIDTH * (1 / 3) - local BUTTON_HEIGHT = 50 - local margin = 20 - local hot = false - local cursor_y = 0 - local total_height = (BUTTON_HEIGHT + margin) * #buttons - for i, button in ipairs(playerCountButtons) do - button.last = button.now - - local bx = (VIRTUAL_WIDTH * 0.5) - (button_width * 0.5) - - local by = (VIRTUAL_HEIGHT * 0.3) - (total_height * 0.5) + cursor_y - if (button.text == "Play") then - by = by + by / 1.8 - end - local color = {255, 255, 255, 255} - local mx, my = love.mouse.getPosition() - mx = mx * DIFFERENCE_X - my = my * DIFFERENCE_Y - hot = (mx > bx and mx < bx + button_width and my > by and my < by + BUTTON_HEIGHT) and i - if (hot == i) then - if (button.text == "Play") then - color = {0 / 255, 255 / 255, 0 / 255, 255} - else - color = {10, 10, 0, 255} - end - end - button.now = love.mouse.isDown(1) - if button.now and not button.last and hot == i then - love.graphics.setColor(0, 0, 0, 1) - love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) - sounds["wallhit"]:play() - if button.text == "Ball Speed: " and nuckemodactive == 1 then - else - button.fn() - end - end - love.graphics.setColor(unpack(color)) - love.graphics.rectangle("fill", bx, by, button_width, BUTTON_HEIGHT) - love.graphics.setColor(0, 0, 0, 255) - local textW = smallfont:getWidth(button.text) - local textH = smallfont:getHeight(button.text) - if (button.text == "1v1") then - love.graphics.print(playertext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5) - elseif button.text == "snc" then - if (nuckemodactive == 1) then - love.graphics.setColor(1, 0, 0, 1) - love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5) - love.graphics.setColor(1, 1, 1, 1) - love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5) - love.graphics.setColor(0, 0, 0, 1) - else - -- - love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH * 0.45 - textW * 0.5, by + textH * 0.5) - end - elseif (button.text == "ballCount") then - love.graphics.print( - "Ball Count: " .. maxBalls, - smallfont, - VIRTUAL_WIDTH * 0.5 - textW * 0.5, - by + textH * 0.5 - ) - elseif (button.text == "Ball Speed: ") then - if (nuckemodactive == 1) then - love.graphics.setColor(1, 0, 0, 1) - love.graphics.print( - "shaitan machina", - smallfont, - VIRTUAL_WIDTH * 0.5 - textW * 0.5, - by + textH * 0.5 - ) - love.graphics.setColor(1, 1, 1, 1) - love.graphics.print( - "shaitan machina", - smallfont, - VIRTUAL_WIDTH * 0.5 - textW * 0.5, - by + textH * 0.5 - ) - love.graphics.setColor(0, 0, 0, 1) - else - love.graphics.print( - button.text .. ballSet, - smallfont, - VIRTUAL_WIDTH * 0.5 - textW * 0.5, - by + textH * 0.5 - ) - end - elseif button.text == "ptw" then - love.graphics.print( - "Points to Win: " .. ptw, - smallfont, - VIRTUAL_WIDTH * 0.5 - textW * 1.5, - by + textH * 0.5 - ) - else - love.graphics.print(button.text, smallfont, VIRTUAL_WIDTH * 0.5 - textW * 0.5, by + textH * 0.5) - end - love.graphics.setColor(255, 255, 255, 255) - cursor_y = cursor_y + (BUTTON_HEIGHT + margin) - end - end -end - -function love.draw() - simpleScale.set() - - baseDraw() - - simpleScale.unSet() -end - ---Check if controls are duplicating -function controllerSer() - for i = 1, maxBalls do - if (ball[i].dy == 0) then - hitNum[i] = hitNum[i] + 1 - if hitNum[i] >= 10 then - ball[i].dy = 1 - hitNum[i] = 0 - end - else - hitNum[i] = 0 - end - end -end - -function palleteController() --!!!!LEGACY CODE, MIGRATED TO Paddle.lua!!!! - if (areanuclear == 0) then - player1.RED = 1 - player1.GREEN = 1 - player1.BLUE = 1 - end - if (areanuclear == 0) then - player2.RED = 1 - player2.GREEN = 1 - player2.BLUE = 1 - end - if (areanuclear == 1) then - player1.RED = 0 - player1.GREEN = 0 - player1.BLUE = 0 - end - if (areanuclear == 1) then - player2.RED = 0 - player2.GREEN = 0 - player2.BLUE = 0 - end -end - -function love.wheelmoved(x, y) - if (y < 0 and wall1width > 0) then - wall1width = wall1width - 5 - elseif y > 0 and wall1width < 900 then - wall1width = wall1width + 5 - end -end - -function serveBot() --THIS IS USED TO CHANGE TEXT/BALL DIRECTION ON DIFFERENT SERVES - --print("servebot called") - if (gameState == "1serve") then - updateTEXT = "" - if (gameMode ~= "practice") then - TEXT = "PLAYER 1, serve!(q)" - end - if ((globalState ~= "clienttest" and love.keyboard.isDown("q")) or (globalState == "clienttest" and lastSentKeyP1 == "q")) then - TEXT = "Lets Begin!" - ball_DIR = 1 - for i = 1, maxBalls do - ball[i]:reset(i) - end - gameState = "play" - - end - end - if (gameState == "2serve") then - TEXT = "PLAYER 2, serve!(p)" - if (AGAINST_AI == 1) then - TEXT = "" - ball_DIR = -1 - for i = 1, maxBalls do - ball[i]:reset(i) - end - - gameState = "play" - - end - if (((globalState == "nettest" and lastSentKeyClient == "p") or ((globalState ~= "nettest") and love.keyboard.isDown("p")))and AGAINST_AI == 0) then - TEXT = "Lets Begin" - ball_DIR = -1 - for i = 1, maxBalls do - ball[i]:reset(i) - end - --love.window.setTitle("An atttttttt") - gameState = "play" - - end - end -end -function mapChanger() - if (gameState == "editor") then - MAP_TYPE = 2 - end - if (MAP_TYPE > 2) then - MAP_TYPE = 0 - end - -end -function resolutionChanger() - if (RESOLUTION_SET > 1) then - RESOLUTION_SET = 0 - end - if (RESOLUTION_SET == 0) then - if (isFullscreen == 1) then - DIFFERENCE_X = 1 - DIFFERENCE_Y = 1 - simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = false}) - isFullscreen = 0 - end - end - if (RESOLUTION_SET == 1) then - if (isFullscreen == 0) then - simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true}) - local newWidth = love.graphics.getWidth() - local newHeight = love.graphics.getHeight() - DIFFERENCE_X = VIRTUAL_WIDTH / newWidth - DIFFERENCE_Y = VIRTUAL_HEIGHT / newHeight - isFullscreen = 1 - end - end -end -function resettinggenius() - maxBalls = 1 - for i = 1, maxBalls do - ball[i]:reset(i) - end - paddle_SPEED = 20 - nuclearanimation = 3 - timeIsSlow = false - timeIsSlow2 = false - originalSpeed = 200 - gameState = "menu" - globalState = "menu" - gameMode = "normal" - player1.height = 100 - player2.height = 100 - ballSet = 200 - ballSpeed = ballSet - player2.GREEN = 255 - player2.BLUE = 255 - player1.GREEN = 255 - player1.BLUE = 255 - player1score = 0 - player2score = 0 - potentialnuke1 = 0 - potentialnuke2 = 0 - striken = 0 - areanuclear = 0 - potentialstrike1 = 0 - potentialstrike2 = 0 - player1nukescore = 0 - player2nukescore = 0 - player1reverbav = 0 - player2reverbav = 0 - selecting = 0 - AGAINST_AI = 0 -end - -function love.mousereleased(x, y, button) - love.keyboard.mouseisReleased = true - if (gameState == "editor") then - if (#walls < 1000 and button == 1 and blockinput ~= true) then - table.insert(walls, newWall(x * DIFFERENCE_X, y * DIFFERENCE_Y, 10, wall1width)) - end - end -end - -function ballsAlive() - for i = 1, maxBalls do - if ball[i].disabled == false then - print("Ball " .. i .. " is not disabled") - return true - end - end - return false -end -function split(s, delimiter) - result = {} - for match in (s..delimiter):gmatch("(.-)"..delimiter) do - table.insert(result, match) - end - return result -end \ No newline at end of file diff --git a/mainMenu.lua b/mainMenu.lua index b3aa777..aaedce3 100644 --- a/mainMenu.lua +++ b/mainMenu.lua @@ -73,7 +73,11 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds for i, button in ipairs(buttons) do --print("Button") button.last = button.now - ev_bx = button.x + if button.x ~= -1 then + ev_bx = button.x + else + ev_bx = locationx - (ev_button_width * 0.5) + end if (location == 'control') then if string.sub(button.text, 1, 1) == '2' then @@ -90,7 +94,9 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds ev_bx = -400 ev_by = -400 elseif button.x > locationx - (ev_button_width * 0.5) then + --print("moving from" .. button.x) button.x = button.x - 15 + --print("moving!" .. button.x) ev_by = locationy - (total_height * 0.5) + cursor_y else ev_by = locationy - (total_height * 0.5) + cursor_y @@ -124,13 +130,20 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds love.graphics.setColor(0,0,0,1) love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) sounds['wallhit']:play() - for i, buttons in ipairs(buttons) do - buttons.x = 1280 - end + if button.skipAnim then + print("skipped anim") + else + for j, buttons in ipairs(buttons) do + buttons.x = 1300 + print("making" .. j) + end + end button.fn() + break end love.graphics.setColor(unpack(color)) love.graphics.rectangle("fill", ev_bx,ev_by, ev_button_width, ev_BUTTON_HEIGHT) + print(ev_bx .. " " .. i) love.graphics.setColor(0, 0, 0, 255) local textW = smallfont:getWidth(button.text) local textH = smallfont:getHeight(button.text) @@ -166,15 +179,19 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds love.graphics.print(playertext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, by+textH*0.5) elseif button.text == 'snc' then if (nuckemodactive == 1) then + textW = smallfont:getWidth(synctext) love.graphics.setColor(1,0,0,1) - love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.7, ev_by+textH*0.5) + love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) love.graphics.setColor(1,1,1,1) - love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.7, ev_by+textH*0.5) + love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) love.graphics.setColor(0,0,0,1) else + textW = smallfont:getWidth(synctext) love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) end elseif (button.text == 'ballCount') then + local tempstr = "Ball Count: " .. maxBalls + textW = smallfont:getWidth(tempstr) love.graphics.print("Ball Count: " .. maxBalls, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) elseif (button.text == "Ball Speed: ") then if (nuckemodactive == 1) then @@ -186,12 +203,17 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds love.graphics.setColor(0,0,0,1) else + textW = smallfont:getWidth(button.text .. ballSet) love.graphics.print(button.text .. ballSet, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) end elseif button.text == 'ptw' then - love.graphics.print("Points to Win: " .. ptw, smallfont, ev_bx + ev_button_width*0.5 - textW * 2.8, ev_by+textH*0.5) + local tempstr = "Points to Win: " .. ptw + textW = smallfont:getWidth(tempstr) + love.graphics.print("Points to Win: " .. ptw, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) elseif (button.text == 'Silverblade') then - love.graphics.print("Difficulty: " .. prtext, smallfont, VIRTUAL_WIDTH*0.5 - textW , ev_by+textH*0.5) + local tempstr = "Difficulty: " .. prtext + textW = smallfont:getWidth(tempstr) + love.graphics.print("Difficulty: " .. prtext, smallfont,ev_bx + ev_button_width*0.5 - textW*0.5 , ev_by+textH*0.5) else love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) end @@ -203,8 +225,15 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds end function mainMenu:addButton(text, fn) + if isButtonAnimated == true then + print("Button shall be animated!") + newButtonXVariable = 1290 + else + print("Button shall NOT be animated!") + newButtonXVariable = -1 + end return { - x = 1290, + x = newButtonXVariable, text = text, fn = fn, now = false, diff --git a/mmm.jpg b/mmm.jpg deleted file mode 100644 index 277edbb..0000000 Binary files a/mmm.jpg and /dev/null differ diff --git a/readme.md b/readme.md index 0fe34c5..dde1046 100644 --- a/readme.md +++ b/readme.md @@ -18,13 +18,19 @@ To play the game on Linux, just launch the ./debuggame.sh and enjoy the game! To play on Linux like a normie, you can Download the latest release (may be outdated compared to the source version), or you can download the LOVE file from the releases tab. To play on Windows, download a Windows executable from the releases tab! # Changes -

0.7.9 is here! Changelog: +

0.8 is here! Changelog:

-

\ No newline at end of file +ToDo: + +

+ + + diff --git a/save.lua b/save.lua deleted file mode 100644 index e69de29..0000000 diff --git a/server/server.lua b/server/server.lua index 52e88a7..2d698d0 100644 --- a/server/server.lua +++ b/server/server.lua @@ -6,79 +6,98 @@ udp:settimeout(0) udp:setsockname('*', 12345) local p1ping = 0 local p2ping = 0 +local requesterip +local requresterport +while running do + local data, msg_or_ip, port_or_nil + local p1data, p2data + repeat -while running do - local data, msg_or_ip, port_or_nil - local p1data, p2data - repeat - data, msg_or_ip, port_or_nil = udp:receivefrom() - if data then - print(string.sub(data,1,1) .. "Playerlist: " .. player1ip .. " " .. player2ip) - if (player1ip == msg_or_ip) then + if data then + + if data == "HELLO" then + requesterip = msg_or_ip + requesterport = port_or_nil + else + print(string.sub(data,1,1) .. "Playerlist: " .. player1ip .. " " .. p1ping .. " " .. player2ip .. " " .. p2ping) + if (player1ip == msg_or_ip) then + p1ping = 0 + p1data = data + elseif player2ip == msg_or_ip then + p2data = data + p2ping = 0 + else + if (player1ip == "none") then + player1ip = msg_or_ip + p1data = data p1ping = 0 - p1data = data - elseif player2ip == msg_or_ip then - p2data = data - p2ping = 0 - else - if (player1ip == "none") then - player1ip = msg_or_ip - p1data = data - p1ping = 0 - player1port = port_or_nil - print("CONNECTED: PLAYER 1 FROM: " .. player1ip) - elseif player2ip == "none" and msg_or_ip ~= player1ip then - player2ip = msg_or_ip - p2data = data - p2ping = 0 - player2port = port_or_nil - print("CONNECTED: PLAYER 2 FROM: " .. player2ip) - elseif (player1ip ~= msg_or_ip and player2ip ~= msg_or_ip) then - print("Lobby Full!" .. player1ip .. player2ip) - end - end + player1port = port_or_nil + print("CONNECTED: PLAYER 1 FROM: " .. player1ip) + elseif player2ip == "none" and msg_or_ip ~= player1ip then + player2ip = msg_or_ip + p2data = data + p2ping = 0 + player2port = port_or_nil + print("CONNECTED: PLAYER 2 FROM: " .. player2ip) + elseif (player1ip ~= msg_or_ip and player2ip ~= msg_or_ip) then + print("Lobby Full!" .. player1ip .. player2ip) + end + end - else -end -until not data -if player1ip ~= "none" then - p1ping = p1ping + 1 - if p1ping > 100 then - if p2data then - udp:sendto(p2data .. '|' .. p1ping, player1ip, player1port) + end + end + until not data + if player1ip ~= "none" then + p1ping = p1ping + 1 + if p1ping > 100 then + if p2data then + udp:sendto(p2data .. '|' .. p1ping, player1ip, player1port) end print("PLAYER 1 DISCONNECTED") - p1data = nil + p1data = nil player1ip = "none" player1port = nil + end end -end -if player2ip ~= "none" then - p2ping = p2ping + 1 - if p2ping > 100 then - if p1data then - udp:sendto(p1data .. '|' .. p2ping, player2ip, player2port) + if player2ip ~= "none" then + p2ping = p2ping + 1 + if p2ping > 100 then + if p1data then + udp:sendto(p1data .. '|' .. p2ping, player2ip, player2port) end print("PLAYER 2 DISCONNECTED") - p2data = nil + p2data = nil player2ip = "none" player2port = nil + end end -end - if p1data and player2port then - udp:sendto(p1data .. '|' .. p2ping, player2ip, player2port) - print("SENT TO " .. player2ip .. ":" .. player2port .. " : " .. string.sub(p1data,1,1)) - end - if p2data and player1port then - udp:sendto(p2data .. '|' .. p1ping, player1ip, player1port) - print("SENT TO " .. player1ip .. ":" .. player1port .. " : " .. string.sub(p2data,1,1)) - --print("1::" .. p1data) - --print("2::" .. p2data) - --print("SENT1: " .. player2ip .. " " .. player2port .. " " .. p1data) - --print("SENT2: " .. player1ip .. " " .. player1port .. " " .. p2data) + if p1data and player2port then + udp:sendto(p1data .. '|' .. p2ping, player2ip, player2port) + --rint("SENT TO " .. player2ip .. ":" .. player2port .. " : " .. string.sub(p1data,1,1)) + end + if p2data and player1port then + udp:sendto(p2data .. '|' .. p1ping, player1ip, player1port) + --print("SENT TO " .. player1ip .. ":" .. player1port .. " : " .. string.sub(p2data,1,1)) + --print("1::" .. p1data) + --print("2::" .. p2data) + --print("SENT1: " .. player2ip .. " " .. player2port .. " " .. p1data) + --print("SENT2: " .. player1ip .. " " .. player1port .. " " .. p2data) + end + if requesterip then + print("getting pnged!") + if player1ip == "none" then + udp:sendto("nettest",requesterip, requesterport) + print("nettest av to: " .. requesterip) + elseif player2ip == "none" then + udp:sendto("clienttest", requesterip, requesterport) + print("clienttest av to: " .. requesterip) + else + udp:sendto("full", requesterip, requesterport) + print("full to: " .. msg_or_ip) end - + requesterip, requesterport = nil + end socket.sleep(0.015) -end \ No newline at end of file +end \ No newline at end of file diff --git a/ship.lua b/ship.lua deleted file mode 100644 index 20c1dbd..0000000 --- a/ship.lua +++ /dev/null @@ -1,75 +0,0 @@ -ship = Class{} - - - - - -function ship:init() - self.y = 0 - self.direction = love.math.random(0, 2) - if self.direction == 0 then - self.y = VIRTUAL_HEIGHT + 100 - self.image = love.graphics.newImage('img/SPC/blue_0' .. love.math.random(1,6) .. '.png') - self.scroll = -1 * love.math.random(80, 120) - background_scroll_speed - else - self.y = -100 - self.image = love.graphics.newImage('img/SPC/red_0' .. love.math.random(1,6) .. '.png') - self.scroll = love.math.random(80, 120) - background_scroll_speed - end - self.x = love.math.random(40, VIRTUAL_WIDTH - 40) - - - self.width = self.image:getWidth() - self.height = self.image:getHeight() - self.destroyed = false - self.deathCounter = 0 -self.deathNumber = 1 -end - -function ship:update(dt) - - --print("Width " .. self.width .. " Height: " .. self.height) - if self.destroyed then - self:deathanimation(dt) - end - self.y = self.y + self.scroll * dt - --print("traveling at " .. self.y .. " " .. self.x) - for i, ball in pairs(ball) do - print("BALL IS AT: " .. ball.x .. " " .. ball.y) - print("I AM AT " .. self.x .. " " .. self.y) - if self:collides(ball) then - print("KABOOM") - self.destroyed = true - end - end -end - -function ship:deathanimation(dt) - self.deathCounter = self.deathCounter + dt - if self.deathCounter > 0.1 and self.deathNumber < 12 then - self.image = love.graphics.newImage('img/SPC/Explosion/explosion-' .. self.deathNumber .. '.png') - self.deathCounter = 0 - self.deathNumber = self.deathNumber + 1 - end -end - -function ship:collides(object) - if (object.y > self.y and object.y < self.y + self.height and - object.x > self.x and - object.x < self.x + self.width ) then - print("!!!!!!!!!!!!!" .. object.y .. " > " .. self.y .. " and " .. object.y .. " < " .. self.y + self.height .. " " .. object.x .. " > " .. self.x .. " and " .. object.x .. " < " .. self.x + self.width) - return true - - else - return false - end - print("Shit detection") -end - -function ship:render() - if self.direction ~= 0 then - love.graphics.draw(self.image, self.x, self.y + self.height, 0, 1, -1) - else - love.graphics.draw(self.image, self.x, self.y) - end -end \ No newline at end of file diff --git a/src/baseGame.lua b/src/baseGame.lua index 9b07e9a..d8c63e3 100644 --- a/src/baseGame.lua +++ b/src/baseGame.lua @@ -1,7 +1,5 @@ local counter = 0 -local ship_timer = 0 function basegame(dt) - shipManager(dt) if gameMode == "reversegame" then reversegame(dt) end @@ -644,9 +642,6 @@ function normalDraw() else love.graphics.clear(40 / 255, 40 / 255, 40 / 255, 1) love.graphics.draw(background, 0, -backgroundScroll) - for k, ship in pairs(ships) do - ship:render() - end end if gameState == "assign" then love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255) @@ -770,7 +765,8 @@ function menuDraw() function() love.keyboard.setTextInput( true, 0, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT/3) end, - "stationary" + true, + 1 ) ) end @@ -785,7 +781,7 @@ function menuDraw() ball[1]:reset(1, 1) player2.dy = 0 end, - "stationary" + true, 1 ) ) table.insert( @@ -796,7 +792,7 @@ function menuDraw() IP = IPnew counter = 0 end, - "stationary" + true, 1 ) ) if status == "offline" then @@ -814,7 +810,7 @@ function menuDraw() ball[1]:reset(1, 1) player2.dy = 0 end, - "stationary" + false, 1 ) ) @@ -831,7 +827,7 @@ function menuDraw() ball[1]:reset(1, 1) player2.dy = 0 end, - "stationary" + false, 1 ) ) elseif status == "full" then @@ -1160,7 +1156,6 @@ function rules(query, i) end end function clientsBaseGame(dt) - shipManager(dt) if gameMode == "reverse" then reversegame(dt) end @@ -1531,6 +1526,41 @@ function menuDemo(dt) if ball[1].x > player2.x-15 then player2.y = ball[1].y-player2.height end + if (MAP_TYPE == 2) then + for i, wall in ipairs(walls) do + if + (ball[1].y > wall.wally and ball[1].y < wall.wally + wall.wallheight and + ball[1].x > wall.wallx - ballSpeed / 200 and + ball[1].x < wall.wallx + 10 + ballSpeed / 200) + then + controllerSer() + soundtype = love.math.random(1, 5) + sounds["wallhit"]:setPitch(ballSpeed / 250) + sounds["wallhit"]:play() + if (ball[1].dx > 0) then + ball[1].x = ball[1].x - 1 + else + ball[1].x = ball[1].x + 1 + end + ball[1].dx = -ball[1].dx + elseif + (ball[1].y > wall.wally - 15 and ball[1].y < wall.wally + wall.wallheight + 10 and + ball[1].x > wall.wallx and + ball[1].x < wall.wallx + 10) + then + controllerSer() + soundtype = love.math.random(1, 5) + sounds["wallhit"]:setPitch(ballSpeed / 250) + sounds["wallhit"]:play() + if (ball[1].dy > 0) then + ball[1].y = ball[1].y - 1 + else + ball[1].y = ball[1].y + 1 + end + ball[1].dy = -ball[1].dy + end + end + end if ball[1].x >= player2.x-7 then sounds["beep"]:setPitch(ballSpeed / 250) sounds["beep"]:play() @@ -1633,7 +1663,8 @@ function effectControl() end end end -local ship_goal = love.math.random(2, 20) +--[[ +THE SHIP FUNCTIONALITY HAS BEEN SCRAPPED AND WONT! BE COMING BACK. function shipManager(dt) ship_timer = ship_timer + dt if ship_timer > ship_goal then @@ -1651,4 +1682,5 @@ function shipManager(dt) table.remove(ships, k) end end -end \ No newline at end of file +end +]] \ No newline at end of file diff --git a/src/dependencies.lua b/src/dependencies.lua index 2e454bf..9354dcd 100644 --- a/src/dependencies.lua +++ b/src/dependencies.lua @@ -14,7 +14,6 @@ require 'src/menus' require 'src/AI' require 'src/reverseGame' require 'explosion' -require 'ship' tick = require 'tick' utf8 = require("utf8") serialize = require 'ser' \ No newline at end of file