@@ -1,11 +1,12 @@ | |||||
button = Class{} | button = Class{} | ||||
function button:init(x, y, width, height, color) | |||||
function button:init(x, y, width, height, color, skipAnim) | |||||
self.x = x | self.x = x | ||||
self.y = y | self.y = y | ||||
self.w = width | self.w = width | ||||
self.h = height | self.h = height | ||||
self.color = color | self.color = color | ||||
self.skipAnim = skipAnim | |||||
end | end | ||||
function button:update(dt) | function button:update(dt) | ||||
@@ -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 |
@@ -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. | |||||
--]===================================================================]-- | |||||
local ffi = require 'ffi' | |||||
local bit = require 'bit' | |||||
local bytearray = ffi.typeof('uint8_t[?]') | |||||
local intarray = ffi.typeof('int[?]') | |||||
local int32ptr = ffi.typeof('int32_t *') | |||||
local intertable = {0, 8, 4, 8, 2, 4, 1, 2, false} | |||||
local function coresume(co, ...) | |||||
local ok, err = coroutine.resume(co, ...) | |||||
if not ok then | |||||
error(err) | |||||
end | |||||
end | |||||
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 | |||||
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 | |||||
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 | |||||
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 |
@@ -25,9 +25,10 @@ showTouchControls = false | |||||
--0.9 VARIABLES | --0.9 VARIABLES | ||||
isButtonAnimated = false | |||||
wallsLoadError = false | wallsLoadError = false | ||||
background = love.graphics.newImage('img/background.jpg') | background = love.graphics.newImage('img/background.jpg') | ||||
bigship = love.graphics.newImage('img/large_red_01.png') | |||||
backgroundScroll = 0 | backgroundScroll = 0 | ||||
background_scroll_speed = 10 | background_scroll_speed = 10 | ||||
@@ -125,20 +126,22 @@ function newTouch(id, x, y) | |||||
originalY = y | originalY = y | ||||
} | } | ||||
end | end | ||||
function newButton(text, fn, sp) | |||||
if sp ~= nil then | |||||
function newButton(text, fn, sp, qp) | |||||
if qp ~= nil then | |||||
return { | return { | ||||
x = (VIRTUAL_WIDTH * 0.5) - VIRTUAL_WIDTH * (1/3)*0.5, | x = (VIRTUAL_WIDTH * 0.5) - VIRTUAL_WIDTH * (1/3)*0.5, | ||||
text = text, | text = text, | ||||
fn = fn, | fn = fn, | ||||
skipAnim = true, | |||||
now = false, | now = false, | ||||
last = false | last = false | ||||
} | } | ||||
else | else | ||||
return { | return { | ||||
x = 1290, | |||||
x = 1300, | |||||
text = text, | text = text, | ||||
fn = fn, | fn = fn, | ||||
skipAnim = sp, | |||||
now = false, | now = false, | ||||
last = false | last = false | ||||
} | } | ||||
@@ -189,7 +192,6 @@ controlSettings = {} | |||||
modeSelectorButtons = {} | modeSelectorButtons = {} | ||||
pracdiff = {} | pracdiff = {} | ||||
playerCountButtons = {} | playerCountButtons = {} | ||||
ships = {} | |||||
function controlChanger() | function controlChanger() | ||||
if (gameState == "assign") then | if (gameState == "assign") then | ||||
love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255) | love.graphics.clear(50 / 255, 50 / 255, 50 / 255, 255) | ||||
@@ -198,7 +200,8 @@ function controlChanger() | |||||
end | end | ||||
function love.load() | function love.load() | ||||
walls = {} | walls = {} | ||||
love.filesystem.createDirectory( "pong" ) | |||||
print(love.filesystem.createDirectory( "pong" )) | |||||
love.filesystem.setIdentity( "pong" ) | |||||
print (love.filesystem.getSaveDirectory()) | print (love.filesystem.getSaveDirectory()) | ||||
print (love.filesystem.getIdentity( )) | print (love.filesystem.getIdentity( )) | ||||
love.graphics.setDefaultFilter('nearest', 'nearest') | love.graphics.setDefaultFilter('nearest', 'nearest') | ||||
@@ -242,7 +245,8 @@ function love.load() | |||||
globalState = "menu" | globalState = "menu" | ||||
hardmanager() | hardmanager() | ||||
end | end | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -253,7 +257,8 @@ function love.load() | |||||
for k in pairs(walls) do | for k in pairs(walls) do | ||||
walls[k] = nil | walls[k] = nil | ||||
end | end | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -263,7 +268,8 @@ function love.load() | |||||
function() | function() | ||||
paused = false | paused = false | ||||
TEXT = "Let's Continue" | TEXT = "Let's Continue" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -287,7 +293,8 @@ function love.load() | |||||
potentialstrike2 = 0 | potentialstrike2 = 0 | ||||
player1nukescore = 0 | player1nukescore = 0 | ||||
player2nukescore = 0 | player2nukescore = 0 | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -304,7 +311,8 @@ function love.load() | |||||
ball[1].dy = 1 | ball[1].dy = 1 | ||||
globalState = "menu" | globalState = "menu" | ||||
hardmanager() | hardmanager() | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
if not isAndroid then | if not isAndroid then | ||||
@@ -318,7 +326,8 @@ function love.load() | |||||
DIFFERENCE_Y = myscreen.d | DIFFERENCE_Y = myscreen.d | ||||
OFFSET_X = myscreen.e | OFFSET_X = myscreen.e | ||||
OFFSET_Y = myscreen.f | OFFSET_Y = myscreen.f | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
end | end | ||||
@@ -332,7 +341,8 @@ function love.load() | |||||
else | else | ||||
musicController("mute", 1) | musicController("mute", 1) | ||||
end | end | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -349,7 +359,8 @@ function love.load() | |||||
ball[1].dy = 1 | ball[1].dy = 1 | ||||
globalState = "menu" | globalState = "menu" | ||||
hardmanager() | hardmanager() | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
@@ -358,8 +369,9 @@ function love.load() | |||||
newButton( | newButton( | ||||
"S", | "S", | ||||
function() | function() | ||||
love.filesystem.write("save.lua", serialize(walls)) | |||||
end | |||||
print(love.filesystem.write("save.lua", serialize(walls))) | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -372,7 +384,8 @@ function love.load() | |||||
walls = {} | walls = {} | ||||
wallsLoadError = true | wallsLoadError = true | ||||
end | end | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -382,7 +395,8 @@ function love.load() | |||||
function() | function() | ||||
ptw = 10 | ptw = 10 | ||||
gameState = "gameMode" | gameState = "gameMode" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -395,7 +409,8 @@ function love.load() | |||||
love.keyboard.setTextInput( true, 0, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT/3) | love.keyboard.setTextInput( true, 0, VIRTUAL_HEIGHT, VIRTUAL_WIDTH, VIRTUAL_HEIGHT/3) | ||||
end | end | ||||
gameState = "chooseIP" | gameState = "chooseIP" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -407,7 +422,8 @@ function love.load() | |||||
AGAINST_AI = 0 | AGAINST_AI = 0 | ||||
gameState = "1serve" | gameState = "1serve" | ||||
ball[1]:reset(1, 1) | ball[1]:reset(1, 1) | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -419,7 +435,8 @@ function love.load() | |||||
AGAINST_AI = 0 | AGAINST_AI = 0 | ||||
gameState = "1serve" | gameState = "1serve" | ||||
ball[1]:reset(1, 1) | ball[1]:reset(1, 1) | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -428,7 +445,8 @@ function love.load() | |||||
"Multiplayer", | "Multiplayer", | ||||
function() | function() | ||||
gameState = "multiMode" | gameState = "multiMode" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
if not isAndroid then | if not isAndroid then | ||||
@@ -439,7 +457,8 @@ function love.load() | |||||
function() | function() | ||||
AGAINST_AI = 0 | AGAINST_AI = 0 | ||||
gameState = "windowsettings" | gameState = "windowsettings" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
else | else | ||||
@@ -454,7 +473,8 @@ function love.load() | |||||
showTouchControls = true | showTouchControls = true | ||||
end | end | ||||
gameState = "touchcontrols" | gameState = "touchcontrols" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
end | end | ||||
@@ -464,7 +484,8 @@ function love.load() | |||||
"Exit", | "Exit", | ||||
function() | function() | ||||
love.event.quit(0) | love.event.quit(0) | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -473,7 +494,8 @@ function love.load() | |||||
"Easy", | "Easy", | ||||
function() | function() | ||||
hardmanager("easy") | hardmanager("easy") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -482,7 +504,8 @@ function love.load() | |||||
"Normal", | "Normal", | ||||
function() | function() | ||||
hardmanager("normal") | hardmanager("normal") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -491,7 +514,8 @@ function love.load() | |||||
"Hard", | "Hard", | ||||
function() | function() | ||||
hardmanager("hard") | hardmanager("hard") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -500,7 +524,8 @@ function love.load() | |||||
"Smart", | "Smart", | ||||
function() | function() | ||||
hardmanager("smart") | hardmanager("smart") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
--table.insert( | --table.insert( | ||||
@@ -522,7 +547,8 @@ function love.load() | |||||
DIFFERENCE_Y = myscreen.d | DIFFERENCE_Y = myscreen.d | ||||
OFFSET_X = myscreen.e | OFFSET_X = myscreen.e | ||||
OFFSET_Y = myscreen.f | OFFSET_Y = myscreen.f | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
if isAndroid then | if isAndroid then | ||||
@@ -536,7 +562,8 @@ function love.load() | |||||
else | else | ||||
musicController("mute", 1) | musicController("mute", 1) | ||||
end | end | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
end | end | ||||
@@ -550,7 +577,8 @@ function love.load() | |||||
else | else | ||||
musicController("mute", 1) | musicController("mute", 1) | ||||
end | end | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -559,7 +587,8 @@ function love.load() | |||||
"Editor", | "Editor", | ||||
function() | function() | ||||
gameState = "editor" | gameState = "editor" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -568,7 +597,8 @@ function love.load() | |||||
"Speed Settings", | "Speed Settings", | ||||
function() | function() | ||||
gameState = "speedSettings" | gameState = "speedSettings" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -577,7 +607,8 @@ function love.load() | |||||
"Control Settings", | "Control Settings", | ||||
function() | function() | ||||
gameState = "controlSettings" | gameState = "controlSettings" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -586,7 +617,8 @@ function love.load() | |||||
"Back to Menu", | "Back to Menu", | ||||
function() | function() | ||||
gameState = "menu" | gameState = "menu" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -595,7 +627,8 @@ function love.load() | |||||
"Back to Menu", | "Back to Menu", | ||||
function() | function() | ||||
gameState = "windowsettings" | gameState = "windowsettings" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
--table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end)) | --table.insert(speedParameters, newButton("Ball Speed: ", function() speedSetter('ball') end)) | ||||
@@ -605,7 +638,8 @@ function love.load() | |||||
"Ball Speed: ", | "Ball Speed: ", | ||||
function() | function() | ||||
speedSetter("ball") | speedSetter("ball") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
--table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end)) | --table.insert(speedParameters, newButton("snc", function() speedSetter('snc') end)) | ||||
@@ -615,7 +649,8 @@ function love.load() | |||||
"snc", | "snc", | ||||
function() | function() | ||||
speedSetter("snc") | speedSetter("snc") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -624,7 +659,8 @@ function love.load() | |||||
"NUCLEAR MODE", | "NUCLEAR MODE", | ||||
function() | function() | ||||
speedSetter("nuclearmod") | speedSetter("nuclearmod") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -634,7 +670,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p1up" | req = "p1up" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -644,7 +681,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p1down" | req = "p1down" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -654,7 +692,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p1super" | req = "p1super" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -664,7 +703,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p1ct" | req = "p1ct" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -674,7 +714,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p2up" | req = "p2up" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -684,7 +725,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p2down" | req = "p2down" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -694,7 +736,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p2super" | req = "p2super" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -704,7 +747,8 @@ function love.load() | |||||
function() | function() | ||||
gameState = "assign" | gameState = "assign" | ||||
req = "p2ct" | req = "p2ct" | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -714,7 +758,8 @@ function love.load() | |||||
function() | function() | ||||
p1control = {up = "a", down = "z", super = "s", counter = "x"} | p1control = {up = "a", down = "z", super = "s", counter = "x"} | ||||
p2control = {up = ";", down = ".", super = "l", counter = ","} | p2control = {up = ";", down = ".", super = "l", counter = ","} | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -723,7 +768,8 @@ function love.load() | |||||
"Return", | "Return", | ||||
function() | function() | ||||
gameState = "windowsettings" | gameState = "windowsettings" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -732,7 +778,8 @@ function love.load() | |||||
"Nuclear Pong", | "Nuclear Pong", | ||||
function() | function() | ||||
gameState = "difficulty" | gameState = "difficulty" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -741,7 +788,8 @@ function love.load() | |||||
"Main Menu", | "Main Menu", | ||||
function() | function() | ||||
gameState = "menu" | gameState = "menu" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -750,7 +798,8 @@ function love.load() | |||||
"Silverblade", | "Silverblade", | ||||
function() | function() | ||||
speedSetter("practice") | speedSetter("practice") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -760,7 +809,8 @@ function love.load() | |||||
function() | function() | ||||
speedSetter("reset") | speedSetter("reset") | ||||
gameState = "gameMode" | gameState = "gameMode" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -770,7 +820,8 @@ function love.load() | |||||
function() | function() | ||||
gameMode = "practice" | gameMode = "practice" | ||||
hardmanager("practice") | hardmanager("practice") | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
--table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end)) | --table.insert(playerCountButtons, newButton("1v1", function() speedSetter('pc') end)) | ||||
@@ -780,7 +831,8 @@ function love.load() | |||||
"ballCount", | "ballCount", | ||||
function() | function() | ||||
speedSetter("ballz") | speedSetter("ballz") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -789,7 +841,8 @@ function love.load() | |||||
"ballCount", | "ballCount", | ||||
function() | function() | ||||
speedSetter("ballz") | speedSetter("ballz") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -800,7 +853,8 @@ function love.load() | |||||
speedSetter("reset") | speedSetter("reset") | ||||
gameState = "menu" | gameState = "menu" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -809,7 +863,8 @@ function love.load() | |||||
"ptw", | "ptw", | ||||
function() | function() | ||||
speedSetter("ptw") | speedSetter("ptw") | ||||
end | |||||
end, | |||||
true | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -820,7 +875,8 @@ function love.load() | |||||
AGAINST_AI = 0 | AGAINST_AI = 0 | ||||
gameState = "1serve" | gameState = "1serve" | ||||
globalState = "base" | globalState = "base" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
table.insert( | table.insert( | ||||
@@ -831,7 +887,8 @@ function love.load() | |||||
gameState = "1serve" | gameState = "1serve" | ||||
gameMode = "reversegame" | gameMode = "reversegame" | ||||
globalState = "base" | globalState = "base" | ||||
end | |||||
end, | |||||
false | |||||
) | ) | ||||
) | ) | ||||
@@ -2438,7 +2495,7 @@ end | |||||
function resetButtonX(arr) | function resetButtonX(arr) | ||||
for i, buttons in ipairs(arr) do | for i, buttons in ipairs(arr) do | ||||
buttons.x = 1290 | |||||
buttons.x = 1300 | |||||
end | end | ||||
end | end | ||||
@@ -73,7 +73,11 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds | |||||
for i, button in ipairs(buttons) do | for i, button in ipairs(buttons) do | ||||
--print("Button") | --print("Button") | ||||
button.last = button.now | 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 (location == 'control') then | ||||
if string.sub(button.text, 1, 1) == '2' 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_bx = -400 | ||||
ev_by = -400 | ev_by = -400 | ||||
elseif button.x > locationx - (ev_button_width * 0.5) then | elseif button.x > locationx - (ev_button_width * 0.5) then | ||||
--print("moving from" .. button.x) | |||||
button.x = button.x - 15 | button.x = button.x - 15 | ||||
--print("moving!" .. button.x) | |||||
ev_by = locationy - (total_height * 0.5) + cursor_y | ev_by = locationy - (total_height * 0.5) + cursor_y | ||||
else | else | ||||
ev_by = locationy - (total_height * 0.5) + cursor_y | 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.setColor(0,0,0,1) | ||||
love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) | love.graphics.rectangle("fill", 0, 0, VIRTUAL_WIDTH, VIRTUAL_HEIGHT) | ||||
sounds['wallhit']:play() | 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() | button.fn() | ||||
break | |||||
end | end | ||||
love.graphics.setColor(unpack(color)) | love.graphics.setColor(unpack(color)) | ||||
love.graphics.rectangle("fill", ev_bx,ev_by, ev_button_width, ev_BUTTON_HEIGHT) | 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) | love.graphics.setColor(0, 0, 0, 255) | ||||
local textW = smallfont:getWidth(button.text) | local textW = smallfont:getWidth(button.text) | ||||
local textH = smallfont:getHeight(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) | love.graphics.print(playertext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, by+textH*0.5) | ||||
elseif button.text == 'snc' then | elseif button.text == 'snc' then | ||||
if (nuckemodactive == 1) then | if (nuckemodactive == 1) then | ||||
textW = smallfont:getWidth(synctext) | |||||
love.graphics.setColor(1,0,0,1) | 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.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) | love.graphics.setColor(0,0,0,1) | ||||
else | 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) | love.graphics.print(synctext, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) | ||||
end | end | ||||
elseif (button.text == 'ballCount') then | 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) | 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 | elseif (button.text == "Ball Speed: ") then | ||||
if (nuckemodactive == 1) 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) | love.graphics.setColor(0,0,0,1) | ||||
else | 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) | love.graphics.print(button.text .. ballSet, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) | ||||
end | end | ||||
elseif button.text == 'ptw' then | 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 | 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 | else | ||||
love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) | love.graphics.print(button.text, smallfont, ev_bx + ev_button_width*0.5 - textW*0.5, ev_by+textH*0.5) | ||||
end | end | ||||
@@ -203,8 +225,15 @@ function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds | |||||
end | end | ||||
function mainMenu:addButton(text, fn) | 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 { | return { | ||||
x = 1290, | |||||
x = newButtonXVariable, | |||||
text = text, | text = text, | ||||
fn = fn, | fn = fn, | ||||
now = false, | now = false, | ||||
@@ -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 <a href = "https://madi-wka.club/NuclearPongLinux.tar.gz">Download</a> 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 Linux like a normie, you can <a href = "https://madi-wka.club/NuclearPongLinux.tar.gz">Download</a> 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! | To play on Windows, download a Windows executable from the releases tab! | ||||
# Changes | # Changes | ||||
<p>0.7.9 is here! Changelog: | |||||
<p>0.8 is here! Changelog: | |||||
<ul> | <ul> | ||||
<li>Added pause menu (hit escape on PC and hit the H button on Android.</li> | |||||
<li>Added win and lose animations</li> | |||||
<li>Fixed musical bugs</li> | |||||
<li>Fixed multiplayer second player lag that came with 0.7.8</li> | |||||
<li>Fixed touch controls on android: controls are no longer dependant on the screen ratio</li> | |||||
<li>Added different tracks for when you are losing or winning (singleplayer/online only)</li> | |||||
<li>Changed the background. Fancy.</li> | |||||
<li>Fixed button text alignment</li> | |||||
<li>Fixed button animations</li> | |||||
<li>Fixed demo and editor not working together</li> | |||||
<li>Removed a lot of clutter</li> | |||||
</ul> | </ul> | ||||
</p> | |||||
ToDo: | |||||
<ul> | |||||
<li>Fix very annoying error with the Editor saving on Linux</li> | |||||
</ul> | |||||
</p> | |||||