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.
love2d-tank/Game/DrawGame.lua

51 lines
1.1 KiB

local function drawFPS()
5 months ago
love.graphics.setColor(1, 1, 1) -- RGB values for white are (1, 1, 1)
4 months ago
love.graphics.setFont(DebugFont)
love.graphics.print("FPS: " .. love.timer.getFPS(), 1520, 10)
end
local function drawHealth()
4 months ago
love.graphics.setFont(GameFont)
1 month ago
local height = love.graphics.getHeight() / _G.Y_SCALE
local width = love.graphics.getWidth() / _G.X_SCALE
2 months ago
love.graphics.print("P1:" .. UserPlayer1.health, 5, 5)
love.graphics.print("P2:" .. UserPlayer2.health, width - 200, height - 95)
5 months ago
end
function DrawGame()
local curWidth, curHeight = love.graphics.getDimensions()
love.graphics.scale(_G.X_SCALE, _G.Y_SCALE)
1 month ago
GameMap:draw(0, 0, _G.X_SCALE, _G.Y_SCALE)
GameMap:resize(curWidth / _G.X_SCALE, curHeight / _G.Y_SCALE)
5 months ago
-- WindField
if DebugFlag then
World:draw()
drawFPS()
end
1 month ago
-- Bullets
5 months ago
for _, v in ipairs(Bullets1) do
v:draw()
end
for _, v in ipairs(Bullets2) do
v:draw()
end
1 month ago
-- PowerUps
for _, v in ipairs(PowerUps) do
v:draw()
end
5 months ago
UserPlayer1:draw()
UserPlayer2:draw()
4 months ago
--Draw Health
1 month ago
--TODO: make this nicer looking
4 months ago
drawHealth()
1 month ago
--TODO: draw running score
--drawScore()
5 months ago
end