|
|
@ -1,21 +1,55 @@ |
|
|
|
|
|
|
|
Object = require("libs/classic") |
|
|
|
|
|
|
|
|
|
|
|
require("constants") |
|
|
|
require("constants") |
|
|
|
WF = require("libs/windfield") |
|
|
|
WF = require("libs/windfield") |
|
|
|
STI = require("libs/sti") |
|
|
|
STI = require("libs/sti") |
|
|
|
|
|
|
|
|
|
|
|
World = WF.newWorld(0, 0) --no gravity |
|
|
|
World = WF.newWorld(0, 0) --no gravity |
|
|
|
World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames |
|
|
|
--World:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames |
|
|
|
World:addCollisionClass("Player1") |
|
|
|
World:addCollisionClass("Player1") |
|
|
|
World:addCollisionClass("Bullet1") |
|
|
|
World:addCollisionClass("Bullet1") |
|
|
|
World:addCollisionClass("Player2") |
|
|
|
World:addCollisionClass("Player2") |
|
|
|
World:addCollisionClass("Bullet2") |
|
|
|
World:addCollisionClass("Bullet2") |
|
|
|
World:addCollisionClass("Wall") |
|
|
|
World:addCollisionClass("Wall") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("restart") |
|
|
|
|
|
|
|
require("player") |
|
|
|
|
|
|
|
require("bullet") |
|
|
|
|
|
|
|
require("mapsloader") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/UpdateGame") |
|
|
|
|
|
|
|
require("Menu/UpdateMenu") |
|
|
|
|
|
|
|
require("Pause/UpdatePause") |
|
|
|
|
|
|
|
require("Win/UpdateWin") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/DrawGame") |
|
|
|
|
|
|
|
require("Menu/DrawMenu") |
|
|
|
|
|
|
|
require("Pause/DrawPause") |
|
|
|
|
|
|
|
require("Win/DrawWin") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/GameKeyPressed") |
|
|
|
|
|
|
|
require("Menu/MenuKeyPressed") |
|
|
|
|
|
|
|
require("Pause/PauseKeyPressed") |
|
|
|
|
|
|
|
require("Win/WinKeyPressed") |
|
|
|
|
|
|
|
|
|
|
|
--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) |
|
|
|
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12) |
|
|
|
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12) |
|
|
|
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45) |
|
|
|
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45) |
|
|
|
Walls = {} |
|
|
|
Walls = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Music streaming |
|
|
|
|
|
|
|
musicMenu = love.audio.newSource("music/menu.mp3", "stream") or nil |
|
|
|
|
|
|
|
musicBattle = love.audio.newSource("music/battle.mp3", "stream") or nil |
|
|
|
|
|
|
|
--musicStory = love.audio.newSource("music/story.mp3", "stream") or nil |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
musicPause = musicBattle:clone() |
|
|
|
|
|
|
|
musicPause:setFilter({ |
|
|
|
|
|
|
|
type = "lowpass", |
|
|
|
|
|
|
|
volume = 0.7, |
|
|
|
|
|
|
|
highgain = 0.4, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function love.run() |
|
|
|
function love.run() |
|
|
|
if love.load then |
|
|
|
if love.load then |
|
|
|
love.load(love.arg.parseGameArguments(arg), arg) |
|
|
|
love.load(love.arg.parseGameArguments(arg), arg) |
|
|
@ -70,34 +104,14 @@ function love.run() |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function love.load() |
|
|
|
function love.load(args) |
|
|
|
Object = require("libs/classic") |
|
|
|
|
|
|
|
require("libs/restart") |
|
|
|
|
|
|
|
require("player") |
|
|
|
|
|
|
|
require("bullet") |
|
|
|
|
|
|
|
require("mapsloader") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/UpdateGame") |
|
|
|
|
|
|
|
require("Menu/UpdateMenu") |
|
|
|
|
|
|
|
require("Pause/UpdatePause") |
|
|
|
|
|
|
|
require("Win/UpdateWin") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/DrawGame") |
|
|
|
|
|
|
|
require("Menu/DrawMenu") |
|
|
|
|
|
|
|
require("Pause/DrawPause") |
|
|
|
|
|
|
|
require("Win/DrawWin") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require("Game/GameKeyPressed") |
|
|
|
|
|
|
|
require("Menu/MenuKeyPressed") |
|
|
|
|
|
|
|
require("Pause/PauseKeyPressed") |
|
|
|
|
|
|
|
require("Win/WinKeyPressed") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Set a random seed |
|
|
|
-- Set a random seed |
|
|
|
love.math.setRandomSeed(love.timer.getTime()) |
|
|
|
love.math.setRandomSeed(love.timer.getTime()) |
|
|
|
|
|
|
|
|
|
|
|
--Game consts |
|
|
|
--Game values (reset after each load) |
|
|
|
HEALTH = 3 |
|
|
|
HEALTH = 3 |
|
|
|
DELAY = 0.5 |
|
|
|
P1_DELAY = 0.5 |
|
|
|
|
|
|
|
P2_DELAY = 0.5 |
|
|
|
|
|
|
|
|
|
|
|
--Bullet lists |
|
|
|
--Bullet lists |
|
|
|
Bullets1 = {} |
|
|
|
Bullets1 = {} |
|
|
@ -106,28 +120,16 @@ function love.load() |
|
|
|
DebugFlag = false |
|
|
|
DebugFlag = false |
|
|
|
EnableKeyPress1 = true |
|
|
|
EnableKeyPress1 = true |
|
|
|
KeyPressTime1 = 0 |
|
|
|
KeyPressTime1 = 0 |
|
|
|
KeyDelay1 = DELAY |
|
|
|
KeyDelay1 = P1_DELAY |
|
|
|
|
|
|
|
|
|
|
|
EnableKeyPress2 = true |
|
|
|
EnableKeyPress2 = true |
|
|
|
KeyPressTime2 = 0 |
|
|
|
KeyPressTime2 = 0 |
|
|
|
KeyDelay2 = DELAY |
|
|
|
KeyDelay2 = P2_DELAY |
|
|
|
|
|
|
|
|
|
|
|
local playerSpeed = 12000 |
|
|
|
local playerSpeed = 12000 |
|
|
|
UserPlayer1 = Player(1, 1000, 100, HEALTH, "assets/player1.png", playerSpeed) |
|
|
|
UserPlayer1 = Player(1, 1000, 100, HEALTH, "assets/player1.png", playerSpeed) |
|
|
|
UserPlayer2 = Player(2, 200, 300, HEALTH, "assets/player2.png", playerSpeed) |
|
|
|
UserPlayer2 = Player(2, 200, 300, HEALTH, "assets/player2.png", playerSpeed) |
|
|
|
|
|
|
|
|
|
|
|
-- Music streaming |
|
|
|
|
|
|
|
musicMenu = love.audio.newSource("music/menu.mp3", "stream") or nil |
|
|
|
|
|
|
|
musicBattle = love.audio.newSource("music/battle.mp3", "stream") or nil |
|
|
|
|
|
|
|
--musicStory = love.audio.newSource("music/story.mp3", "stream") or nil |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
musicPause = musicBattle:clone() |
|
|
|
|
|
|
|
musicPause:setFilter({ |
|
|
|
|
|
|
|
type = "lowpass", |
|
|
|
|
|
|
|
volume = 0.7, |
|
|
|
|
|
|
|
highgain = 0.4, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--STI Map loading |
|
|
|
--STI Map loading |
|
|
|
LoadMap(_G.CUR_LEVEL) |
|
|
|
LoadMap(_G.CUR_LEVEL) |
|
|
|
end |
|
|
|
end |
|
|
|