You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.3 KiB
60 lines
1.3 KiB
function love.load()
|
|
Object = require("classic")
|
|
require("player")
|
|
require("bullet")
|
|
WF = require("libs/windfield")
|
|
require("UpdateGame")
|
|
require("DrawGame")
|
|
require("KeyPressed")
|
|
|
|
love.profiler = require("libs/profile")
|
|
love.profiler.start()
|
|
|
|
--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")
|
|
|
|
HEALTH = 3
|
|
DELAY = 0.5
|
|
DebugFlag = false
|
|
EnableKeyPress1 = true
|
|
KeyPressTime1 = 0
|
|
KeyDelay1 = DELAY
|
|
EnableKeyPress2 = true
|
|
KeyPressTime2 = 0
|
|
KeyDelay2 = DELAY
|
|
|
|
UserPlayer1 = Player(1, 1000, 100, HEALTH, "assets/player1.png", 100)
|
|
UserPlayer2 = Player(2, 800, 300, HEALTH, "assets/player2.png", 100)
|
|
Bullets1 = {}
|
|
Bullets2 = {}
|
|
end
|
|
|
|
function love.keypressed(key)
|
|
KeyPressed(key)
|
|
end
|
|
|
|
love.frame = 0
|
|
function love.update(dt)
|
|
--[[
|
|
love.frame = love.frame + 1
|
|
if love.frame % 100 == 0 then
|
|
love.report = love.profiler.report(20)
|
|
love.profiler.reset()
|
|
end
|
|
]]
|
|
UpdateGame(dt)
|
|
end
|
|
|
|
function love.draw()
|
|
DrawGame()
|
|
if DebugFlag then
|
|
love.graphics.print("Debug Mode", 1200, 850)
|
|
-- love.graphics.print(love.report or "Please wait...")
|
|
end
|
|
end
|
|
|