60 lines
No EOL
960 B
Lua
60 lines
No EOL
960 B
Lua
class = require "libs/middleclass"
|
|
Timer = require "libs/hump/timer"
|
|
Input = require "input"
|
|
require "color"
|
|
require "room"
|
|
require "player"
|
|
|
|
function love.load()
|
|
_initDefaults()
|
|
_initGridVars()
|
|
|
|
loadSprites()
|
|
|
|
inputTimer = Timer.new()
|
|
|
|
currentRoom = Room:new{
|
|
player = {
|
|
red = {x = 3, y = 5},
|
|
green = {x = 4, y = 3},
|
|
blue = {x = 3, y = 10}
|
|
}
|
|
}
|
|
end
|
|
|
|
function love.update(dt)
|
|
Input:handler()
|
|
|
|
currentRoom:update()
|
|
end
|
|
|
|
function love.draw()
|
|
love.graphics.setBlendMode("screen")
|
|
currentRoom:draw()
|
|
end
|
|
|
|
function _initDefaults()
|
|
love.graphics.setDefaultFilter("linear", "nearest")
|
|
|
|
width = love.graphics.getWidth()
|
|
height = love.graphics.getHeight()
|
|
|
|
if width > height then
|
|
width = height
|
|
else
|
|
height = width
|
|
end
|
|
end
|
|
|
|
function _initGridVars()
|
|
gridWidth, gridHeight = 11, 11
|
|
drawScale = width / gridWidth / 16
|
|
end
|
|
|
|
function createCanvases()
|
|
|
|
end
|
|
|
|
function loadSprites()
|
|
playerSprite = love.graphics.newImage("art/player.png")
|
|
end |