-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
50 lines (39 loc) · 1.11 KB
/
main.lua
File metadata and controls
50 lines (39 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- imports
local Utils = require "lib.utils"
local Vec = require "lib.vector"
local Player = require "entities.player"
local Dungeon = require "lib.dungeon"
local Camera = require "lib.camera"
-- consts
SCREEN_HEIGHT = 600
SCREEN_WIDTH = 600
CELL_SIZE = 16
function love.load()
love.graphics.setBackgroundColor(0, 0, 0)
love.graphics.setDefaultFilter('nearest', 'nearest') -- Avoids blurring when pixel art is zoomed
floor = love.graphics.newImage('assets/img/floor.png')
moon = Player:new(
love.graphics.newImage('assets/img/moon.png'),
Vec:new(0, 0)
)
CM = Camera.newManager() -- camera yap
CM.setScale(1.5)
CM.setDeadzone(-16,-16,16,16)
CM.setLerp(0.2)
CM.setOffset(0)
CM.setCoords(0, 0)
lvl1 = Dungeon:create(5)
end
function love.update(dt)
Player:update(moon, dt)
CM.setTarget(moon.pos.x+8, moon.pos.y+8)
CM.update(dt)
end
function love.draw()
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS()), 10, 10) -- print fps
CM.attach()
Dungeon:draw(lvl1)
Player:draw(moon)
CM.detach()
--CM.debug()
end