@@ -0,0 +1,46 @@ | |||
--- TSerial v1.3, a simple table serializer which turns tables into Lua script | |||
-- @author Taehl (SelfMadeSpirit@gmail.com) | |||
TSerial = {} | |||
--- Serializes a table into a string, in form of Lua script. | |||
-- @param t table to be serialized (may not contain any circular reference) | |||
-- @param drop if true, unserializable types will be silently dropped instead of raising errors | |||
-- if drop is a function, it will be called to serialize unsupported types | |||
-- @param indent if true, output "human readable" mode with newlines and indentation (for debug) | |||
-- @return string recreating given table | |||
function TSerial.pack(t, drop, indent) | |||
assert(type(t) == "table", "Can only TSerial.pack tables.") | |||
local s, indent = "{"..(indent and "\n" or ""), indent and math.max(type(indent)=="number" and indent or 0,0) | |||
for k, v in pairs(t) do | |||
local tk, tv, skip = type(k), type(v) | |||
if tk == "boolean" then k = k and "[true]" or "[false]" | |||
elseif tk == "string" then if string.format("%q",k) ~= '"'..k..'"' then k = '['..string.format("%q",k)..']' end | |||
elseif tk == "number" then k = "["..k.."]" | |||
elseif tk == "table" then k = "["..TSerial.pack(k, drop, indent and indent+1).."]" | |||
elseif type(drop) == "function" then k = "["..string.format("%q",drop(k)).."]" | |||
elseif drop then skip = true | |||
else error("Attempted to TSerial.pack a table with an invalid key: "..tostring(k)) | |||
end | |||
if tv == "boolean" then v = v and "true" or "false" | |||
elseif tv == "string" then v = string.format("%q", v) | |||
elseif tv == "number" then -- no change needed | |||
elseif tv == "table" then v = TSerial.pack(v, drop, indent and indent+1) | |||
elseif type(drop) == "function" then v = "["..string.format("%q",drop(v)).."]" | |||
elseif drop then skip = true | |||
else error("Attempted to TSerial.pack a table with an invalid value: "..tostring(v)) | |||
end | |||
if not skip then s = s..string.rep("\t",indent or 0)..k.."="..v..","..(indent and "\n" or "") end | |||
end | |||
return s..string.rep("\t",(indent or 1)-1).."}" | |||
end | |||
--- Loads a table into memory from a string (like those output by Tserial.pack) | |||
-- @param s a string of Lua defining a table, such as "{2,4,8,ex="ample"}" | |||
-- @return a table recreated from the given string | |||
function TSerial.unpack(s) | |||
assert(type(s) == "string", "Can only TSerial.unpack strings.") | |||
assert(loadstring("TSerial.table="..s))() | |||
local t = TSerial.table | |||
TSerial.table = nil | |||
return t | |||
end |
@@ -0,0 +1,47 @@ | |||
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 |
@@ -0,0 +1,94 @@ | |||
--[[ | |||
Copyright (c) 2010-2013 Matthias Richter | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in | |||
all copies or substantial portions of the Software. | |||
Except as contained in this notice, the name(s) of the above copyright holders | |||
shall not be used in advertising or otherwise to promote the sale, use or | |||
other dealings in this Software without prior written authorization. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
THE SOFTWARE. | |||
]]-- | |||
local function include_helper(to, from, seen) | |||
if from == nil then | |||
return to | |||
elseif type(from) ~= 'table' then | |||
return from | |||
elseif seen[from] then | |||
return seen[from] | |||
end | |||
seen[from] = to | |||
for k,v in pairs(from) do | |||
k = include_helper({}, k, seen) -- keys might also be tables | |||
if to[k] == nil then | |||
to[k] = include_helper({}, v, seen) | |||
end | |||
end | |||
return to | |||
end | |||
-- deeply copies `other' into `class'. keys in `other' that are already | |||
-- defined in `class' are omitted | |||
local function include(class, other) | |||
return include_helper(class, other, {}) | |||
end | |||
-- returns a deep copy of `other' | |||
local function clone(other) | |||
return setmetatable(include({}, other), getmetatable(other)) | |||
end | |||
local function new(class) | |||
-- mixins | |||
class = class or {} -- class can be nil | |||
local inc = class.__includes or {} | |||
if getmetatable(inc) then inc = {inc} end | |||
for _, other in ipairs(inc) do | |||
if type(other) == "string" then | |||
other = _G[other] | |||
end | |||
include(class, other) | |||
end | |||
-- class implementation | |||
class.__index = class | |||
class.init = class.init or class[1] or function() end | |||
class.include = class.include or include | |||
class.clone = class.clone or clone | |||
-- constructor call | |||
return setmetatable(class, {__call = function(c, ...) | |||
local o = setmetatable({}, c) | |||
o:init(...) | |||
return o | |||
end}) | |||
end | |||
-- interface for cross class-system compatibility (see https://github.com/bartbes/Class-Commons). | |||
if class_commons ~= false and not common then | |||
common = {} | |||
function common.class(name, prototype, parent) | |||
return new{__includes = {prototype, parent}} | |||
end | |||
function common.instance(class, ...) | |||
return class(...) | |||
end | |||
end | |||
-- the module | |||
return setmetatable({new = new, include = include, clone = clone}, | |||
{__call = function(_,...) return new(...) end}) |
@@ -0,0 +1,96 @@ | |||
eball = Class{} | |||
function eball:init(x, y, width, height) | |||
self.x = x | |||
self.y = y | |||
self.width = width | |||
self.height = height | |||
self.dy = math.random(-1, 1) | |||
self.dx = 1 | |||
end | |||
function eball:collides(paddle) | |||
if paddle.player == 2 and gameMode == 'practice' then return false | |||
else | |||
if self.x > paddle.x + paddle.width or paddle.x > self.x + self.width then | |||
return false | |||
end | |||
if self.y > paddle.y + paddle.height or paddle.y > self.y + self.height then | |||
return false | |||
end | |||
return true | |||
end | |||
end | |||
function eball:reset(ballnum) | |||
if (gameMode == 'practice') then | |||
if (self.x < 1) then | |||
--love.window.setTitle(self.x) | |||
self.x = VIRTUAL_WIDTH /2 - 2 | |||
self.y = VIRTUAL_HEIGHT /2 - 2 | |||
self.dy = math.random(-1, 1) | |||
self.dx = math.random(-1,1) | |||
else self.x = self.x self.y = self.y self.dx = -1 end | |||
else | |||
if (ballnum == 2) then | |||
self.dx = ball_DIR * -1 | |||
else | |||
self.dx = ball_DIR | |||
end | |||
self.x = VIRTUAL_WIDTH /2 - 2 | |||
self.y = VIRTUAL_HEIGHT /2 - 2 | |||
self.dy = math.random(-1, 1) | |||
--love.window.setTitle("LMAOOOOOO") | |||
end | |||
end | |||
function eball:update(dt) | |||
if player1nukescore > 20 then | |||
potentialstrike1 = 1 | |||
else | |||
potentialstrike1 = 0 | |||
end | |||
if player1nukescore > 140 then | |||
player1reverbav = 1 | |||
else | |||
player1reverbav = 0 | |||
end | |||
if player1nukescore > 200 then | |||
potentialnuke1 = 1 | |||
else | |||
potentialnuke1 = 0 | |||
end | |||
if player2nukescore > 20 then | |||
potentialstrike2 = 1 | |||
else | |||
potentialstrike2 = 0 | |||
end | |||
if player2nukescore > 140 then | |||
player2reverbav = 1 | |||
else | |||
player2reverbav = 0 | |||
end | |||
if player2nukescore > 200 then | |||
potentialnuke2 = 1 | |||
else | |||
potentialnuke2 = 0 | |||
end | |||
self.x = self.x + ballSpeed * self.dx * dt | |||
self.y = self.y + ballSpeed * self.dy * dt | |||
end | |||
function eball:render(color) | |||
if color == 'black' then | |||
love.graphics.setColor(0,0,0,1) | |||
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height) | |||
elseif color == 'controlled' then | |||
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height) | |||
else | |||
love.graphics.setColor(1,1,1,1) | |||
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height) | |||
end | |||
end |
@@ -0,0 +1,33 @@ | |||
fullScreener = Class{} | |||
function fullScreener:init(a,b,c,d) | |||
self.a = a | |||
self.b = b | |||
self.c = c | |||
self.d = d | |||
end | |||
function fullScreener:toggle(vh, vw) | |||
self.a = self.a + 1 | |||
if (self.a > 1) then | |||
self.a = 0 | |||
end | |||
if (self.a == 0 ) then | |||
if (self.b == 1) then | |||
self.c = 1 | |||
self.d = 1 | |||
simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT,{fullscreen = false}) | |||
self.b = 0 | |||
end | |||
end | |||
if (self.a == 1) then | |||
if (self.b == 0) then | |||
simpleScale.updateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, {fullscreen = true}) | |||
local newWidth = love.graphics.getWidth() | |||
local newHeight = love.graphics.getHeight() | |||
self.c = VIRTUAL_WIDTH / newWidth | |||
self.d = VIRTUAL_HEIGHT / newHeight | |||
self.b = 1 | |||
end | |||
end | |||
end |
@@ -0,0 +1,219 @@ | |||
mainMenu = Class{} | |||
function mainMenu:butt(gameState, VIRTUAL_WIDTH, VIRTUAL_HEIGHT, buttons, sounds, location) | |||
if (gameState == 'editor') | |||
then | |||
ev_button_width = VIRTUAL_WIDTH * (1/72) | |||
ev_BUTTON_HEIGHT = VIRTUAL_WIDTH * (1/72) | |||
local margin = 16 | |||
local hot = false | |||
local cursor_y = 0 | |||
blockinput = false | |||
local total_height = (ev_BUTTON_HEIGHT + margin) * #buttons | |||
for i, button in ipairs(buttons) do | |||
button.last = button.now | |||
ev_bx = (VIRTUAL_WIDTH*0.05) - (ev_button_width * 0.5) | |||
ev_by = (VIRTUAL_HEIGHT * 0.1) - (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 > 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 | |||
blockinput = blockinput or true | |||
color = {10, 10, 0, 255} | |||
end | |||
button.now = love.keyboard.mouseWasReleased() | |||
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.05 - textW*0.5, ev_by*0.9+textH*0.01) | |||
love.graphics.setColor(255, 255, 255, 255) | |||
cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) | |||
end | |||
else | |||
if location == 'middle' then | |||
locationx = (VIRTUAL_WIDTH * 0.5) | |||
locationy = (VIRTUAL_HEIGHT* 0.5) | |||
elseif location == 'right' then | |||
locationx = (VIRTUAL_WIDTH * 0.8) | |||
locationy = (VIRTUAL_HEIGHT* 0.5) | |||
elseif location == 'control' then | |||
locationx = (VIRTUAL_WIDTH * 0.2) | |||
locationy = (VIRTUAL_HEIGHT* 0.5) | |||
end | |||
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) * #buttons | |||
local ev_bx, ev_by | |||
for i, button in ipairs(buttons) do | |||
button.last = button.now | |||
if (location == 'control') then | |||
if string.sub(button.text, 1, 1) == '2' then | |||
ev_bx = (VIRTUAL_WIDTH*0.2) - (ev_button_width * 0.5) | |||
ev_by = locationy - (total_height * 0.5) + cursor_y | |||
elseif string.sub(button.text, 1, 1) == '1' then | |||
ev_bx = (VIRTUAL_WIDTH*0.8) - (ev_button_width * 0.5) | |||
ev_by = locationy - (total_height * 0.5) + cursor_y | |||
else | |||
ev_bx = (VIRTUAL_WIDTH*0.5) - (ev_button_width * 0.5) | |||
ev_by = locationy - (total_height * 0.5) + cursor_y | |||
end | |||
elseif button.text == 'NUCLEAR MODE' and easternum < 11 then | |||
ev_bx = -400 | |||
ev_by = -400 | |||
else | |||
ev_bx = locationx - (ev_button_width * 0.5) | |||
ev_by = locationy - (total_height * 0.5) + cursor_y | |||
end | |||
if (button.text == 'Play') and location == 'playercount' then color = {0/255, 255/255, 0/255, 255} else | |||
color = {10, 10, 0, 255} | |||
end | |||
local color = {255, 255, 255, 255} | |||
if (button.text == 'NUCLEAR MODE' and easternum > 10) then | |||
color = {0,0,0,1} | |||
else | |||
color = {1,1,1,1} | |||
end | |||
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.keyboard.mouseWasReleased() | |||
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) | |||
if (location == 'control') then | |||
if (button.text == "1up") then | |||
love.graphics.print("Player 1 UP: " .. string.upper(p1control.up), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '2up' then | |||
love.graphics.print("Player 2 UP: " .. string.upper(p2control.up), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '1down' then | |||
love.graphics.print("Player 1 DOWN: " .. string.upper(p1control.down), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '2down' then | |||
love.graphics.print("Player 2 DOWN: " .. string.upper(p2control.down), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '1special' then | |||
love.graphics.print("Player 1 SPECIAL: " .. string.upper(p1control.super), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '2special' then | |||
love.graphics.print("Player 2 SPECIAL: " .. string.upper(p2control.super), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '1ct' then | |||
love.graphics.print("Player 1 COUNTER: " .. string.upper(p1control.counter), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
elseif button.text == '2ct' then | |||
love.graphics.print("Player 2 COUNTER: " .. string.upper(p2control.counter), smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
else | |||
love.graphics.print(button.text, smallfont, ev_bx + (ev_button_width * 0.1), ev_by+textH*0.5) | |||
end | |||
cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) | |||
else | |||
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, ev_by+textH*0.5) | |||
love.graphics.setColor(1,1,1,1) | |||
love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, ev_by+textH*0.5) | |||
love.graphics.setColor(0,0,0,1) | |||
else | |||
love.graphics.print(synctext, smallfont, VIRTUAL_WIDTH*0.45 - textW*0.5, ev_by+textH*0.5) | |||
end | |||
elseif (button.text == 'ballCount') then | |||
love.graphics.print("Ball Count: " .. maxBalls, smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, ev_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, ev_by+textH*0.5) | |||
love.graphics.setColor(1,1,1,1) | |||
love.graphics.print("shaitan machina", smallfont, VIRTUAL_WIDTH*0.5 - textW*0.5, ev_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, ev_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, 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) | |||
else | |||
love.graphics.print(button.text, smallfont, locationx - textW*0.5, ev_by+textH*0.5) | |||
end | |||
love.graphics.setColor(255, 255, 255, 255) | |||
cursor_y = cursor_y + (ev_BUTTON_HEIGHT + margin) | |||
end | |||
end | |||
end | |||
end | |||
function mainMenu:addButton(text, fn) | |||
return { | |||
text = text, | |||
fn = fn, | |||
now = false, | |||
last = false | |||
} | |||
end | |||
function menuButtons() | |||
local button_width = VIRTUAL_WIDTH * (1/3) | |||
local BUTTON_HEIGHT = 50 | |||
local margin = 16 | |||
local hot = false | |||
local cursor_y = 0 | |||
local total_height = (BUTTON_HEIGHT + margin) * #buttons | |||
for i, button in ipairs(buttons) do | |||
button.last = button.now | |||
local bx = (VIRTUAL_WIDTH*0.5) - (button_width * 0.5) | |||
local by = (VIRTUAL_HEIGHT * 0.8) - (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.keyboard.mouseWasReleased() | |||
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 |
@@ -0,0 +1,39 @@ | |||
function musicController(orders, toggling) | |||
if (orders == 'norm') then | |||
if (gameState ~= 'play' and gameState ~= '1serve' and gameState ~= '2serve' and areanuclear == 0) then | |||
sounds['gayTheme']:stop() | |||
sounds['gayTheme2']:stop() | |||
sounds['updateMusic']:play() | |||
elseif (areanuclear == 1) then | |||
sounds['gayTheme']:setVolume(0) | |||
sounds['gayTheme2']:setVolume(0) | |||
elseif ((gameState == 'play' or gameState == '1serve' or gameState == '2serve') and player1score <= 7 and player2score <= 7 and areanuclear == 0) then | |||
sounds['updateMusic']:stop() | |||
sounds['gayTheme']:setPitch(1) | |||
sounds['gayTheme']:setLooping(true) | |||
sounds['gayTheme']:setVolume(0.5) | |||
sounds['gayTheme']:play() | |||
elseif gameState == 'play' and player1score > 7 or player2score > 7 and areanuclear == 0 then | |||
sounds['gayTheme']:stop() | |||
sounds['updateMusic']:stop() | |||
sounds['gayTheme2']:setPitch(1) | |||
sounds['gayTheme2']:setLooping(true) | |||
sounds['gayTheme2']:setVolume(0.5) | |||
sounds['gayTheme2']:play() | |||
else | |||
end | |||
elseif order ~= nil then | |||
sounds[orders]:setPitch(1) | |||
sounds[orders]:setLooping(true) | |||
sounds[orders]:setVolume(0.9) | |||
sounds[orders]:play() | |||
if (toggling == 1) then | |||
sounds[orders]:setVolume(0.9) | |||
else | |||
sounds[orders]:setVolume(0) | |||
end | |||
end | |||
end |
@@ -0,0 +1,69 @@ | |||
paddle = Class{} | |||
function paddle:init(x, y, width, height, player) | |||
self.RED = 255 | |||
self.GREEN = 255 | |||
self.BLUE = 255 | |||
self.x = x | |||
self.y = y | |||
self.width = width | |||
self.height = height | |||
self.dy = 0 | |||
self.xy = x | |||
self.yx = y | |||
self.velocity = 0 | |||
self.shadowbonus = 0 | |||
self.player = player | |||
end | |||
function paddle:update(dt) | |||
if ((self.player == 1 and timeIsSlow2) or self.player == 2 and timeIsSlow) then | |||
self.dy = self.dy / 2 | |||
end | |||
if (self.dy == 0) then | |||
self.velocity = self.velocity / 1.1 | |||
if (self.velocity < 1 and self.velocity > -1) then | |||
self.velocity = 0 | |||
end | |||
else | |||
self.velocity = self.velocity + self.dy*dt | |||
end | |||
if (self.velocity < 0) then | |||
if (self.y > 0) then | |||
self.y = self.y + self.velocity | |||
else | |||
self.velocity = 0 | |||
end | |||
elseif (self.velocity > 0) then | |||
if (self.y < VIRTUAL_HEIGHT - 80) then | |||
self.y = self.y + self.velocity | |||
else | |||
self.velocity = 0 | |||
end | |||
else | |||
self.velocity = 0 | |||
end | |||
if ((timeIsSlow == false and self.player == 1) or (timeIsSlow2 == false and self.player == 2)) then | |||
if (math.abs(self.yx - self.y) < 11) then | |||
self.yx = self.y | |||
end | |||
if (self.yx < self.y) then | |||
self.yx = self.yx + math.abs(paddle_SPEED/1.7) | |||
elseif (self.yx > self.y) then | |||
self.yx = self.yx - math.abs(paddle_SPEED/1.7) | |||
end | |||
end | |||
end | |||
function paddle:render() | |||
love.graphics.setColor(self.RED, self.GREEN, self.BLUE, 60/255) | |||
love.graphics.rectangle('fill', self.xy, self.yx, self.width, self.height, 20, 20) | |||
love.graphics.setColor(self.RED, self.GREEN, self.BLUE, 255) | |||
love.graphics.rectangle('fill', self.x, self.y, self.width, self.height, 20, 20) | |||
love.graphics.setColor(255, 255, 255, 255) | |||
end |
@@ -0,0 +1,272 @@ | |||
local love11 = love.getVersion() == 11 | |||
local getDPI = love11 and love.window.getDPIScale or love.window.getPixelScale | |||
local windowUpdateMode = love11 and love.window.updateMode or function(width, height, settings) | |||
local _, _, flags = love.window.getMode() | |||
for k, v in pairs(settings) do flags[k] = v end | |||
love.window.setMode(width, height, flags) | |||
end | |||
local push = { | |||
defaults = { | |||
fullscreen = false, | |||
resizable = false, | |||
pixelperfect = false, | |||
highdpi = true, | |||
canvas = true, | |||
stencil = true | |||
} | |||
} | |||
setmetatable(push, push) | |||
function push:applySettings(settings) | |||
for k, v in pairs(settings) do | |||
self["_" .. k] = v | |||
end | |||
end | |||
function push:resetSettings() return self:applySettings(self.defaults) end | |||
function push:setupScreen(WWIDTH, WHEIGHT, RWIDTH, RHEIGHT, settings) | |||
settings = settings or {} | |||
self._WWIDTH, self._WHEIGHT = WWIDTH, WHEIGHT | |||
self._RWIDTH, self._RHEIGHT = RWIDTH, RHEIGHT | |||
self:applySettings(self.defaults) --set defaults first | |||
self:applySettings(settings) --then fill with custom settings | |||
windowUpdateMode(self._RWIDTH, self._RHEIGHT, { | |||
fullscreen = self._fullscreen, | |||
resizable = self._resizable, | |||
highdpi = self._highdpi | |||
}) | |||
self:initValues() | |||
if self._canvas then | |||
self:setupCanvas({ "default" }) --setup canvas | |||
end | |||
self._borderColor = {0, 0, 0} | |||
self._drawFunctions = { | |||
["start"] = self.start, | |||
["end"] = self.finish | |||
} | |||
return self | |||
end | |||
function push:setupCanvas(canvases) | |||
table.insert(canvases, { name = "_render", private = true }) --final render | |||
self._canvas = true | |||
self.canvases = {} | |||
for i = 1, #canvases do | |||
push:addCanvas(canvases[i]) | |||
end | |||
return self | |||
end | |||
function push:addCanvas(params) | |||
table.insert(self.canvases, { | |||
name = params.name, | |||
private = params.private, | |||
shader = params.shader, | |||
canvas = love.graphics.newCanvas(self._WWIDTH, self._WHEIGHT), | |||
stencil = params.stencil or self._stencil | |||
}) | |||
end | |||
function push:setCanvas(name) | |||
if not self._canvas then return true end | |||
return love.graphics.setCanvas(self:getCanvasTable(name).canvas) | |||
end | |||
function push:getCanvasTable(name) | |||
for i = 1, #self.canvases do | |||
if self.canvases[i].name == name then | |||
return self.canvases[i] | |||
end | |||
end | |||
end | |||
function push:setShader(name, shader) | |||
if not shader then | |||
self:getCanvasTable("_render").shader = name | |||
else | |||
self:getCanvasTable(name).shader = shader | |||
end | |||
end | |||
function push:initValues() | |||
self._PSCALE = (not love11 and self._highdpi) and getDPI() or 1 | |||
self._SCALE = { | |||
x = self._RWIDTH/self._WWIDTH * self._PSCALE, | |||
y = self._RHEIGHT/self._WHEIGHT * self._PSCALE | |||
} | |||
if self._stretched then --if stretched, no need to apply offset | |||
self._OFFSET = {x = 0, y = 0} | |||
else | |||
local scale = math.min(self._SCALE.x, self._SCALE.y) | |||
if self._pixelperfect then scale = math.floor(scale) end | |||
self._OFFSET = {x = (self._SCALE.x - scale) * (self._WWIDTH/2), y = (self._SCALE.y - scale) * (self._WHEIGHT/2)} | |||
self._SCALE.x, self._SCALE.y = scale, scale --apply same scale to X and Y | |||
end | |||
self._GWIDTH = self._RWIDTH * self._PSCALE - self._OFFSET.x * 2 | |||
self._GHEIGHT = self._RHEIGHT * self._PSCALE - self._OFFSET.y * 2 | |||
end | |||
function push:apply(operation, shader) | |||
self._drawFunctions[operation](self, shader) | |||
end | |||
function push:start() | |||
if self._canvas then | |||
love.graphics.push() | |||
love.graphics.setCanvas({ self.canvases[1].canvas, stencil = self.canvases[1].stencil }) | |||
else | |||
love.graphics.translate(self._OFFSET.x, self._OFFSET.y) | |||
love.graphics.setScissor(self._OFFSET.x, self._OFFSET.y, self._WWIDTH*self._SCALE.x, self._WHEIGHT*self._SCALE.y) | |||
love.graphics.push() | |||
love.graphics.scale(self._SCALE.x, self._SCALE.y) | |||
end | |||
end | |||
function push:applyShaders(canvas, shaders) | |||
local _shader = love.graphics.getShader() | |||
if #shaders <= 1 then | |||
love.graphics.setShader(shaders[1]) | |||
love.graphics.draw(canvas) | |||
else | |||
local _canvas = love.graphics.getCanvas() | |||
local _tmp = self:getCanvasTable("_tmp") | |||
if not _tmp then --create temp canvas only if needed | |||
self:addCanvas({ name = "_tmp", private = true, shader = nil }) | |||
_tmp = self:getCanvasTable("_tmp") | |||
end | |||
love.graphics.push() | |||
love.graphics.origin() | |||
local outputCanvas | |||
for i = 1, #shaders do | |||
local inputCanvas = i % 2 == 1 and canvas or _tmp.canvas | |||
outputCanvas = i % 2 == 0 and canvas or _tmp.canvas | |||
love.graphics.setCanvas(outputCanvas) | |||
love.graphics.clear() | |||
love.graphics.setShader(shaders[i]) | |||
love.graphics.draw(inputCanvas) | |||
love.graphics.setCanvas(inputCanvas) | |||
end | |||
love.graphics.pop() | |||
love.graphics.setCanvas(_canvas) | |||
love.graphics.draw(outputCanvas) | |||
end | |||
love.graphics.setShader(_shader) | |||
end | |||
function push:finish(shader) | |||
love.graphics.setBackgroundColor(unpack(self._borderColor)) | |||
if self._canvas then | |||
local _render = self:getCanvasTable("_render") | |||
love.graphics.pop() | |||
local white = love11 and 1 or 255 | |||
love.graphics.setColor(white, white, white) | |||
--draw canvas | |||
love.graphics.setCanvas(_render.canvas) | |||
for i = 1, #self.canvases do --do not draw _render yet | |||
local _table = self.canvases[i] | |||
if not _table.private then | |||
local _canvas = _table.canvas | |||
local _shader = _table.shader | |||
self:applyShaders(_canvas, type(_shader) == "table" and _shader or { _shader }) | |||
end | |||
end | |||
love.graphics.setCanvas() | |||
--draw render | |||
love.graphics.translate(self._OFFSET.x, self._OFFSET.y) | |||
local shader = shader or _render.shader | |||
love.graphics.push() | |||
love.graphics.scale(self._SCALE.x, self._SCALE.y) | |||
self:applyShaders(_render.canvas, type(shader) == "table" and shader or { shader }) | |||
love.graphics.pop() | |||
--clear canvas | |||
for i = 1, #self.canvases do | |||
love.graphics.setCanvas(self.canvases[i].canvas) | |||
love.graphics.clear() | |||
end | |||
love.graphics.setCanvas() | |||
love.graphics.setShader() | |||
else | |||
love.graphics.pop() | |||
love.graphics.setScissor() | |||
end | |||
end | |||
function push:setBorderColor(color, g, b) | |||
self._borderColor = g and {color, g, b} or color | |||
end | |||
function push:toGame(x, y) | |||
x, y = x - self._OFFSET.x, y - self._OFFSET.y | |||
local normalX, normalY = x / self._GWIDTH, y / self._GHEIGHT | |||
x = (x >= 0 and x <= self._WWIDTH * self._SCALE.x) and normalX * self._WWIDTH or nil | |||
y = (y >= 0 and y <= self._WHEIGHT * self._SCALE.y) and normalY * self._WHEIGHT or nil | |||
return x, y | |||
end | |||
--doesn't work - TODO | |||
function push:toReal(x, y) | |||
return x + self._OFFSET.x, y + self._OFFSET.y | |||
end | |||
function push:switchFullscreen(winw, winh) | |||
self._fullscreen = not self._fullscreen | |||
local windowWidth, windowHeight = love.window.getDesktopDimensions() | |||
if self._fullscreen then --save windowed dimensions for later | |||
self._WINWIDTH, self._WINHEIGHT = self._RWIDTH, self._RHEIGHT | |||
elseif not self._WINWIDTH or not self._WINHEIGHT then | |||
self._WINWIDTH, self._WINHEIGHT = windowWidth * .5, windowHeight * .5 | |||
end | |||
self._RWIDTH = self._fullscreen and windowWidth or winw or self._WINWIDTH | |||
self._RHEIGHT = self._fullscreen and windowHeight or winh or self._WINHEIGHT | |||
self:initValues() | |||
love.window.setFullscreen(self._fullscreen, "desktop") | |||
if not self._fullscreen and (winw or winh) then | |||
windowUpdateMode(self._RWIDTH, self._RHEIGHT) --set window dimensions | |||
end | |||
end | |||
function push:resize(w, h) | |||
if self._highdpi then w, h = w / self._PSCALE, h / self._PSCALE end | |||
self._RWIDTH = w | |||
self._RHEIGHT = h | |||
self:initValues() | |||
end | |||
function push:getWidth() return self._WWIDTH end | |||
function push:getHeight() return self._WHEIGHT end | |||
function push:getDimensions() return self._WWIDTH, self._WHEIGHT end | |||
return push |
@@ -0,0 +1,26 @@ | |||
<h1>NuclearPong!</h1> | |||
Pong reimagined. Poorly reimagined. | |||
<h1 class = "text-center">The basics: </h1> | |||
<h3 class = "text-center">As easy as riding a bike</h3> | |||
<h5 class = "text-center">*if you can ride a bike</h5> | |||
<div class = "row padding"> | |||
<div class = "col-sm-6"> | |||
<h3>Default controls for player 1: </h3> | |||
<ul> | |||
<li><b>[A] for up</b></li> | |||
<li><b>[Z] for down</b></li> | |||
<li><b>[S] while your counter says [S] and is white for a strong attack</b></li> | |||
<li><b>[S] while your counter says [S] and is red to drop a NUKE</b></li> | |||
<li><b>[X] while your counter says [X] to slow down time</b></li> | |||
</ul> | |||
<h3>Default controls for player 2: </h3> | |||
<ul> | |||
<li><b>[;] for up</b></li> | |||
<li><b>[.] for down</b></li> | |||
<li><b>[L] while your counter says [L] and is white for a strong attack</b></li> | |||
<li><b>[L] while your counter says [L] and is red to drop a NUKE</b></li> | |||
<li><b>[,] while your counter says [,] to slow down time</b></li> | |||
</ul> | |||
</div> |
@@ -0,0 +1,121 @@ | |||
local pairs, ipairs, tostring, type, concat, dump, floor, format = pairs, ipairs, tostring, type, table.concat, string.dump, math.floor, string.format | |||
local function getchr(c) | |||
return "\\" .. c:byte() | |||
end | |||
local function make_safe(text) | |||
return ("%q"):format(text):gsub('\n', 'n'):gsub("[\128-\255]", getchr) | |||
end | |||
local oddvals = {[tostring(1/0)] = '1/0', [tostring(-1/0)] = '-1/0', [tostring(-(0/0))] = '-(0/0)', [tostring(0/0)] = '0/0'} | |||
local function write(t, memo, rev_memo) | |||
local ty = type(t) | |||
if ty == 'number' then | |||
t = format("%.17g", t) | |||
return oddvals[t] or t | |||
elseif ty == 'boolean' or ty == 'nil' then | |||
return tostring(t) | |||
elseif ty == 'string' then | |||
return make_safe(t) | |||
elseif ty == 'table' or ty == 'function' then | |||
if not memo[t] then | |||
local index = #rev_memo + 1 | |||
memo[t] = index | |||
rev_memo[index] = t | |||
end | |||
return '_[' .. memo[t] .. ']' | |||
else | |||
error("Trying to serialize unsupported type " .. ty) | |||
end | |||
end | |||
local kw = {['and'] = true, ['break'] = true, ['do'] = true, ['else'] = true, | |||
['elseif'] = true, ['end'] = true, ['false'] = true, ['for'] = true, | |||
['function'] = true, ['goto'] = true, ['if'] = true, ['in'] = true, | |||
['local'] = true, ['nil'] = true, ['not'] = true, ['or'] = true, | |||
['repeat'] = true, ['return'] = true, ['then'] = true, ['true'] = true, | |||
['until'] = true, ['while'] = true} | |||
local function write_key_value_pair(k, v, memo, rev_memo, name) | |||
if type(k) == 'string' and k:match '^[_%a][_%w]*$' and not kw[k] then | |||
return (name and name .. '.' or '') .. k ..'=' .. write(v, memo, rev_memo) | |||
else | |||
return (name or '') .. '[' .. write(k, memo, rev_memo) .. ']=' .. write(v, memo, rev_memo) | |||
end | |||
end | |||
-- fun fact: this function is not perfect | |||
-- it has a few false positives sometimes | |||
-- but no false negatives, so that's good | |||
local function is_cyclic(memo, sub, super) | |||
local m = memo[sub] | |||
local p = memo[super] | |||
return m and p and m < p | |||
end | |||
local function write_table_ex(t, memo, rev_memo, srefs, name) | |||
if type(t) == 'function' then | |||
return '_[' .. name .. ']=loadstring' .. make_safe(dump(t)) | |||
end | |||
local m = {} | |||
local mi = 1 | |||
for i = 1, #t do -- don't use ipairs here, we need the gaps | |||
local v = t[i] | |||
if v == t or is_cyclic(memo, v, t) then | |||
srefs[#srefs + 1] = {name, i, v} | |||
m[mi] = 'nil' | |||
mi = mi + 1 | |||
else | |||
m[mi] = write(v, memo, rev_memo) | |||
mi = mi + 1 | |||
end | |||
end | |||
for k,v in pairs(t) do | |||
if type(k) ~= 'number' or floor(k) ~= k or k < 1 or k > #t then | |||
if v == t or k == t or is_cyclic(memo, v, t) or is_cyclic(memo, k, t) then | |||
srefs[#srefs + 1] = {name, k, v} | |||
else | |||
m[mi] = write_key_value_pair(k, v, memo, rev_memo) | |||
mi = mi + 1 | |||
end | |||
end | |||
end | |||
return '_[' .. name .. ']={' .. concat(m, ',') .. '}' | |||
end | |||
return function(t) | |||
local memo = {[t] = 0} | |||
local rev_memo = {[0] = t} | |||
local srefs = {} | |||
local result = {} | |||
-- phase 1: recursively descend the table structure | |||
local n = 0 | |||
while rev_memo[n] do | |||
result[n + 1] = write_table_ex(rev_memo[n], memo, rev_memo, srefs, n) | |||
n = n + 1 | |||
end | |||
-- phase 2: reverse order | |||
for i = 1, n*.5 do | |||
local j = n - i + 1 | |||
result[i], result[j] = result[j], result[i] | |||
end | |||
-- phase 3: add all the tricky cyclic stuff | |||
for i, v in ipairs(srefs) do | |||
n = n + 1 | |||
result[n] = write_key_value_pair(v[2], v[3], memo, rev_memo, '_[' .. v[1] .. ']') | |||
end | |||
-- phase 4: add something about returning the main table | |||
if result[n]:sub(1, 5) == '_[0]=' then | |||
result[n] = 'return ' .. result[n]:sub(6) | |||
else | |||
result[n + 1] = 'return _[0]' | |||
end | |||
-- phase 5: just concatenate everything | |||
result = concat(result, '\n') | |||
return n > 1 and 'local _={}\n' .. result or result | |||
end |
@@ -0,0 +1,123 @@ | |||
simpleScale = {} | |||
--Your Game's Aspect Ratio | |||
local gAspectRatio | |||
--The Window's Aspect Ratio | |||
local wAspectRatio | |||
--The scale between the game and the window's aspect ratio | |||
simpleScale.scale = 1 | |||
local xt, yt = 0, 0, 1 | |||
local gameW, gameH, windowW, windowH = 800, 600, 800, 600 | |||
-- Declares your game's width and height, and sets the window size/settings | |||
-- To be used instead of love.window.setMode | |||
-- [gw] and [gh] are the width and height of the initial game | |||
-- [sw] and [sh] (optional) are the width and height of the final window | |||
-- [settings] (optional) are settings for love.window.setMode | |||
function simpleScale.setWindow(gw, gh, sw, sh, settings) | |||
sw = sw or gw | |||
sh = sh or gh | |||
gAspectRatio = gw/gh | |||
gameW = gw | |||
gameH = gh | |||
simpleScale.updateWindow(sw, sh, settings) | |||
end | |||
-- Updates the Window size/settings | |||
-- To be used instead of love.window.setMode | |||
-- [sw] and [sh] are the width and height of the new Window | |||
-- [settings] (optional) are settings for love.window.setMode | |||
function simpleScale.updateWindow(sw, sh, settings) | |||
love.window.setMode(sw, sh, settings) | |||
windowW, windowH = love.graphics.getWidth(), love.graphics.getHeight() | |||
wAspectRatio = windowW/windowH | |||
--Window aspect ratio is TALLER than game | |||
if gAspectRatio > wAspectRatio then | |||
scale = windowW/gameW | |||
xt = 0 | |||
yt = windowH/2 - (scale*gameH)/2 | |||
--Window aspect ratio is WIDER than game | |||
elseif gAspectRatio < wAspectRatio then | |||
scale = windowH/gameH | |||
xt = windowW/2 - (scale*gameW)/2 | |||
yt = 0 | |||
--Window and game aspect ratios are EQUAL | |||
else | |||
scale = windowW/gameW | |||
xt = 0 | |||
yt = 0 | |||
end | |||
simpleScale.scale = scale | |||
end | |||
-- If you screen is resizable on drag, you'll need to call this to make sure | |||
-- the appropriate screen values stay updated | |||
-- You can call it on love.update() with no trouble | |||
function simpleScale.resizeUpdate() | |||
windowW, windowH = love.graphics.getWidth(), love.graphics.getHeight() | |||
wAspectRatio = windowW/windowH | |||
--Window aspect ratio is TALLER than game | |||
if gAspectRatio > wAspectRatio then | |||
scale = windowW/gameW | |||
xt = 0 | |||
yt = windowH/2 - (scale*gameH)/2 | |||
--Window aspect ratio is WIDER than game | |||
elseif gAspectRatio < wAspectRatio then | |||
scale = windowH/gameH | |||
xt = windowW/2 - (scale*gameW)/2 | |||
yt = 0 | |||
--Window and game aspect ratios are EQUAL | |||
else | |||
scale = windowW/gameW | |||
xt = 0 | |||
yt = 0 | |||
end | |||
simpleScale.scale = scale | |||
end | |||
-- Transforms the game's window relative to the entire window | |||
-- Call this at the beginning of love.draw() | |||
function simpleScale.set() | |||
love.graphics.push() | |||
love.graphics.translate(xt, yt) | |||
love.graphics.scale(scale, scale) | |||
end | |||
-- Untransforms the game's window | |||
-- Call this at the end of love.draw | |||
-- You can optionally make the letterboxes a specific color by passing | |||
-- [color] (optional) a table of color values | |||
function simpleScale.unSet(color) | |||
love.graphics.scale(1/scale, 1/scale) | |||
love.graphics.translate(-xt, -yt) | |||
love.graphics.pop() | |||
--Draw the Letterboxes | |||
local r,g,b,a = love.graphics.getColor() | |||
local originalColor = love.graphics.getColor() | |||
local boxColor | |||
if color == nil then | |||
boxColor = {0,0,0} | |||
else | |||
boxColor = color | |||
end | |||
love.graphics.setColor(boxColor) | |||
--Horizontal bars | |||
if gAspectRatio > wAspectRatio then | |||
love.graphics.rectangle("fill", 0, 0, windowW, math.abs((gameH*scale - (windowH))/2)) | |||
love.graphics.rectangle("fill", 0, windowH, windowW, -math.abs((gameH*scale - (windowH))/2)) | |||
--Vertical bars | |||
elseif gAspectRatio < wAspectRatio then | |||
love.graphics.rectangle("fill", 0, 0, math.abs((gameW*scale - (windowW))/2),windowH) | |||
love.graphics.rectangle("fill", windowW, 0, -math.abs((gameW*scale - (windowW))/2),windowH) | |||
end | |||
love.graphics.setColor(r,g,b,a) | |||
end |
@@ -0,0 +1,8 @@ | |||
function powerControl(initiate, type) | |||
if initiate == 1 and type == 'special' then | |||
sounds["time"]:play() player1reverbav = false timeIsSlow = true originalSpeed = ballSpeed originalPaddle = paddle_SPEED player1reverbav = 0 potentialnuke1 = 0 potentialstrike1 = 0 | |||
end | |||
end | |||
function powerUpdate() | |||
end |