Compare commits
No commits in common. '19e10d66016cb750fd83b58599962127d844a207' and '16f90a075b61e597931a175e7fba11a140e2284f' have entirely different histories.
19e10d6601
...
16f90a075b
@ -1,21 +1,14 @@ |
||||
function GameKeyPressed(key) |
||||
|
||||
if key == "escape" then |
||||
musicBattle:setVolume(0) |
||||
musicPause:setVolume(0.5) |
||||
|
||||
_G.GAMESTATE = "PAUSE" |
||||
print("STATE CHANEGD: PAUSED!") |
||||
_G.PAUSED = true |
||||
_G.GAMESTATE = "MENU" |
||||
print("STATE CHANEGD: MENU!") |
||||
end |
||||
|
||||
if key == "b" and not _G.PAUSED then |
||||
if key == "b" then |
||||
DebugFlag = not DebugFlag |
||||
end |
||||
|
||||
--[[ |
||||
if key == "r" and not _G.PAUSED then |
||||
if key == "r" then |
||||
love.load() |
||||
end |
||||
]]-- |
||||
end |
||||
|
@ -1,45 +0,0 @@ |
||||
local function button(x,y, w, h, text, selected) |
||||
--x,y is the top left corner of the button |
||||
local rounding = 30 -- used for rounding the buttons |
||||
|
||||
if not selected then |
||||
love.graphics.setColor(love.math.colorFromBytes(41,134,204)) |
||||
elseif selected then |
||||
love.graphics.setColor(love.math.colorFromBytes(244,67,54)) |
||||
end |
||||
-- Draw rectangle |
||||
love.graphics.rectangle("fill", x, y, w, h, rounding, rounding) |
||||
|
||||
-- Get width and height of text |
||||
local tw = MenuFont:getWidth(text) |
||||
local th = MenuFont:getHeight(text) |
||||
-- Calculate position to center the text |
||||
local textX = x + (w - tw) / 2 |
||||
local textY = y + (h - th) / 2 |
||||
-- Place text inside the rectangle |
||||
love.graphics.setFont(MenuFont) |
||||
love.graphics.setColor(1,1,1) -- reset colours |
||||
love.graphics.print(text, textX, textY) |
||||
end |
||||
|
||||
|
||||
function DrawPause() |
||||
local opacity = 0.3 |
||||
local height = love.graphics.getHeight() |
||||
local width = love.graphics.getWidth() |
||||
local bwidth, bheight = 300, 140 |
||||
love.graphics.setFont(GameFont) |
||||
|
||||
DrawGame() --Draw a single frame of the game |
||||
love.graphics.setColor(0.1,0.1,0.1, opacity) --overlay opaque img |
||||
love.graphics.rectangle("fill", 0, 0, width, height) |
||||
|
||||
love.graphics.setColor(1,1,1) |
||||
love.graphics.print("PAUSED", 100,100) |
||||
--love.graphics.print("" .. PAUSE_POS, 200,200) |
||||
|
||||
button(100, 200, bwidth, bheight, "Return", PAUSE_POS == 0 and true or false) |
||||
button(100, 350, bwidth, bheight, "Menu", PAUSE_POS == 1 and true or false) |
||||
button(100, 500, bwidth, bheight, "Quit", PAUSE_POS == 2 and true or false) |
||||
love.graphics.setColor(255,255,255) -- reset colours |
||||
end |
@ -1,44 +0,0 @@ |
||||
function PauseKeyPressed(key) |
||||
if key == 'return' then |
||||
musicBattle:setVolume(0.5) |
||||
musicPause:setVolume(0) |
||||
-- 0 Return to game |
||||
-- 1 Quit |
||||
if PAUSE_POS == 0 then |
||||
-- unpause the game |
||||
_G.GAMESTATE = "GAME" |
||||
print("STATE CHANEGD: GAME!") |
||||
_G.PAUSED = false |
||||
musicBattle:setVolume(0.5) |
||||
musicPause:setVolume(0) |
||||
|
||||
elseif PAUSE_POS == 1 then |
||||
_G.GAMESTATE = "MENU" |
||||
print("STATE CHANEGD: MENU!") |
||||
_G.PAUSED = false |
||||
musicPause:stop() |
||||
musicBattle:stop() |
||||
|
||||
elseif PAUSE_POS == 2 then |
||||
love.event.quit() |
||||
end |
||||
|
||||
end |
||||
|
||||
|
||||
if love.keyboard.isDown("up") then |
||||
if _G.PAUSE_POS == 0 then |
||||
_G.PAUSE_POS = 0 |
||||
else |
||||
_G.PAUSE_POS = _G.PAUSE_POS - 1 |
||||
end |
||||
end |
||||
|
||||
if love.keyboard.isDown("down") then |
||||
if _G.PAUSE_POS >= _G.PAUSE_MAX then |
||||
_G.PAUSE_POS = _G.PAUSE_MAX |
||||
else |
||||
_G.PAUSE_POS = _G.PAUSE_POS + 1 |
||||
end |
||||
end |
||||
end |
@ -1,2 +0,0 @@ |
||||
function UpdatePause(dt) |
||||
end |
@ -1,30 +0,0 @@ |
||||
# Tanks-A-Lot (LÖVE2D Game) |
||||
|
||||
## How to install |
||||
|
||||
### Download |
||||
|
||||
### Build from source (LÖVE2D must be installed already) |
||||
To build and make **.love** file: |
||||
```sh |
||||
zip -r game.love . -x '*.git*' |
||||
``` |
||||
To play, use: |
||||
```sh |
||||
love game.love |
||||
``` |
||||
|
||||
## How to Play |
||||
|
||||
## Credits |
||||
|
||||
* Programming: Simon |
||||
* Art: Laura |
||||
* Music: AJ |
||||
|
||||
# TODOS |
||||
* Links to socials |
||||
* Exe files |
||||
* Release stuff |
||||
* how to play instructions |
||||
* images for git |
@ -1,8 +1,3 @@ |
||||
GAMESTATE = "MENU" |
||||
|
||||
MENU_POS = 0 |
||||
MENU_MAX = 3 --0 play, 1 ?, 2 ?, 3 quit |
||||
|
||||
PAUSED = false |
||||
PAUSE_POS = 0 |
||||
PAUSE_MAX = 2 -- 0 resume, 1 menu, 2 quit |
||||
MENU_MAX = 3 |
@ -1,68 +0,0 @@ |
||||
-- |
||||
-- classic |
||||
-- |
||||
-- Copyright (c) 2014, rxi |
||||
-- |
||||
-- This module is free software; you can redistribute it and/or modify it under |
||||
-- the terms of the MIT license. See LICENSE for details. |
||||
-- |
||||
|
||||
|
||||
local Object = {} |
||||
Object.__index = Object |
||||
|
||||
|
||||
function Object:new() |
||||
end |
||||
|
||||
|
||||
function Object:extend() |
||||
local cls = {} |
||||
for k, v in pairs(self) do |
||||
if k:find("__") == 1 then |
||||
cls[k] = v |
||||
end |
||||
end |
||||
cls.__index = cls |
||||
cls.super = self |
||||
setmetatable(cls, self) |
||||
return cls |
||||
end |
||||
|
||||
|
||||
function Object:implement(...) |
||||
for _, cls in pairs({...}) do |
||||
for k, v in pairs(cls) do |
||||
if self[k] == nil and type(v) == "function" then |
||||
self[k] = v |
||||
end |
||||
end |
||||
end |
||||
end |
||||
|
||||
|
||||
function Object:is(T) |
||||
local mt = getmetatable(self) |
||||
while mt do |
||||
if mt == T then |
||||
return true |
||||
end |
||||
mt = getmetatable(mt) |
||||
end |
||||
return false |
||||
end |
||||
|
||||
|
||||
function Object:__tostring() |
||||
return "Object" |
||||
end |
||||
|
||||
|
||||
function Object:__call(...) |
||||
local obj = setmetatable({}, self) |
||||
obj:new(...) |
||||
return obj |
||||
end |
||||
|
||||
|
||||
return Object |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue