|
|
@ -1,4 +1,14 @@ |
|
|
|
require("constants") |
|
|
|
require("constants") |
|
|
|
|
|
|
|
WF = require("libs/windfield") |
|
|
|
|
|
|
|
STI = require("libs/sti") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
World = WF.newWorld(0, 0) --no gravity |
|
|
|
|
|
|
|
World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames |
|
|
|
|
|
|
|
World:addCollisionClass("Player1") |
|
|
|
|
|
|
|
World:addCollisionClass("Bullet1") |
|
|
|
|
|
|
|
World:addCollisionClass("Player2") |
|
|
|
|
|
|
|
World:addCollisionClass("Bullet2") |
|
|
|
|
|
|
|
World:addCollisionClass("Wall") |
|
|
|
|
|
|
|
|
|
|
|
function love.run() |
|
|
|
function love.run() |
|
|
|
if love.load then |
|
|
|
if love.load then |
|
|
@ -56,40 +66,25 @@ end |
|
|
|
|
|
|
|
|
|
|
|
function love.load() |
|
|
|
function love.load() |
|
|
|
Object = require("libs/classic") |
|
|
|
Object = require("libs/classic") |
|
|
|
|
|
|
|
require("libs/restart") |
|
|
|
require("player") |
|
|
|
require("player") |
|
|
|
require("bullet") |
|
|
|
require("bullet") |
|
|
|
|
|
|
|
require("mapsloader") |
|
|
|
WF = require("libs/windfield") |
|
|
|
|
|
|
|
STI = require("libs/sti") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/UpdateGame") |
|
|
|
require("Game/UpdateGame") |
|
|
|
require("Menu/UpdateMenu") |
|
|
|
require("Menu/UpdateMenu") |
|
|
|
require("Pause/UpdatePause") |
|
|
|
require("Pause/UpdatePause") |
|
|
|
|
|
|
|
require("Win/UpdateWin") |
|
|
|
|
|
|
|
|
|
|
|
require("Game/DrawGame") |
|
|
|
require("Game/DrawGame") |
|
|
|
require("Menu/DrawMenu") |
|
|
|
require("Menu/DrawMenu") |
|
|
|
require("Pause/DrawPause") |
|
|
|
require("Pause/DrawPause") |
|
|
|
|
|
|
|
require("Win/DrawWin") |
|
|
|
|
|
|
|
|
|
|
|
require("Game/GameKeyPressed") |
|
|
|
require("Game/GameKeyPressed") |
|
|
|
require("Menu/MenuKeyPressed") |
|
|
|
require("Menu/MenuKeyPressed") |
|
|
|
require("Pause/PauseKeyPressed") |
|
|
|
require("Pause/PauseKeyPressed") |
|
|
|
|
|
|
|
require("Win/WinKeyPressed") |
|
|
|
require("mapsloader") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--WindField |
|
|
|
|
|
|
|
World = WF.newWorld(0, 0) --no gravity |
|
|
|
|
|
|
|
World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames |
|
|
|
|
|
|
|
World:addCollisionClass("Player1") |
|
|
|
|
|
|
|
World:addCollisionClass("Bullet1") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
World:addCollisionClass("Player2") |
|
|
|
|
|
|
|
World:addCollisionClass("Bullet2") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
World:addCollisionClass("Wall") |
|
|
|
|
|
|
|
World:addCollisionClass("New") -- Used to make sure the bullet doesn't collide with the player that shot it |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--STI Map |
|
|
|
|
|
|
|
loadMap(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Fonts used in the game |
|
|
|
--Fonts used in the game |
|
|
|
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60) |
|
|
|
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60) |
|
|
@ -105,6 +100,8 @@ function love.load() |
|
|
|
Bullets1 = {} |
|
|
|
Bullets1 = {} |
|
|
|
Bullets2 = {} |
|
|
|
Bullets2 = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Walls = {} |
|
|
|
|
|
|
|
|
|
|
|
DebugFlag = false |
|
|
|
DebugFlag = false |
|
|
|
EnableKeyPress1 = true |
|
|
|
EnableKeyPress1 = true |
|
|
|
KeyPressTime1 = 0 |
|
|
|
KeyPressTime1 = 0 |
|
|
@ -129,6 +126,9 @@ function love.load() |
|
|
|
volume = 0.7, |
|
|
|
volume = 0.7, |
|
|
|
highgain = 0.4, |
|
|
|
highgain = 0.4, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--STI Map loading |
|
|
|
|
|
|
|
LoadMap(1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function love.keypressed(key) |
|
|
|
function love.keypressed(key) |
|
|
@ -141,6 +141,9 @@ function love.keypressed(key) |
|
|
|
if _G.GAMESTATE == "GAME" then |
|
|
|
if _G.GAMESTATE == "GAME" then |
|
|
|
GameKeyPressed(key) |
|
|
|
GameKeyPressed(key) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
if _G.GAMESTATE == "WIN" then |
|
|
|
|
|
|
|
WinKeyPressed(key) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function love.update(dt) |
|
|
|
function love.update(dt) |
|
|
@ -173,9 +176,7 @@ function love.update(dt) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
if _G.GAMESTATE == "WIN" then |
|
|
|
if _G.GAMESTATE == "WIN" then |
|
|
|
print(P1_WIN) |
|
|
|
UpdateWin(dt) |
|
|
|
print(P2_WIN) |
|
|
|
|
|
|
|
love.event.quit() |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -194,4 +195,7 @@ function love.draw() |
|
|
|
love.graphics.print("" .. GAMESTATE, 200, 200) |
|
|
|
love.graphics.print("" .. GAMESTATE, 200, 200) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
if _G.GAMESTATE == "WIN" then |
|
|
|
|
|
|
|
DrawWin() |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|