main
Simon Kellet 2 months ago
parent a392755844
commit 71d1f6e929
  1. 24
      main.lua

@ -10,6 +10,12 @@ World:addCollisionClass("Player2")
World:addCollisionClass("Bullet2") World:addCollisionClass("Bullet2")
World:addCollisionClass("Wall") World:addCollisionClass("Wall")
--Fonts used in the game
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60)
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12)
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45)
Walls = {}
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)
@ -86,10 +92,8 @@ function love.load()
require("Pause/PauseKeyPressed") require("Pause/PauseKeyPressed")
require("Win/WinKeyPressed") require("Win/WinKeyPressed")
--Fonts used in the game -- Set a random seed
GameFont = love.graphics.newFont("assets/Daydream.ttf", 60) love.math.setRandomSeed(love.timer.getTime())
DebugFont = love.graphics.newFont("assets/Daydream.ttf", 12)
MenuFont = love.graphics.newFont("assets/Daydream.ttf", 45)
--Game consts --Game consts
HEALTH = 3 HEALTH = 3
@ -99,8 +103,6 @@ function love.load()
Bullets1 = {} Bullets1 = {}
Bullets2 = {} Bullets2 = {}
Walls = {}
DebugFlag = false DebugFlag = false
EnableKeyPress1 = true EnableKeyPress1 = true
KeyPressTime1 = 0 KeyPressTime1 = 0
@ -127,7 +129,7 @@ function love.load()
}) })
--STI Map loading --STI Map loading
LoadMap(1) LoadMap(_G.CUR_LEVEL)
end end
function love.keypressed(key) function love.keypressed(key)
@ -158,8 +160,8 @@ function love.update(dt)
UpdatePause(dt) UpdatePause(dt)
-- Handle music -- Handle music
if not musicPause:isPlaying() then if not musicPause:isPlaying() then
--musicBattle:setVolume(0) musicBattle:setVolume(0)
--musicPause:setVolume(0.5) musicPause:setVolume(0.5)
love.audio.play(musicBattle) love.audio.play(musicBattle)
love.audio.play(musicPause) love.audio.play(musicPause)
end end
@ -168,8 +170,8 @@ function love.update(dt)
UpdateGame(dt) UpdateGame(dt)
-- Handle music -- Handle music
if not musicBattle:isPlaying() then if not musicBattle:isPlaying() then
--musicBattle:setVolume(0.5) musicBattle:setVolume(0.5)
--musicPause:setVolume(0) musicPause:setVolume(0)
love.audio.play(musicBattle) love.audio.play(musicBattle)
love.audio.play(musicPause) love.audio.play(musicPause)
end end

Loading…
Cancel
Save