boxes n walls n movement etcgit status
This commit is contained in:
parent
9763040c99
commit
2772ec2563
10 changed files with 318 additions and 45 deletions
28
main.lua
28
main.lua
|
|
@ -1,9 +1,10 @@
|
|||
class = require "libs/middleclass"
|
||||
Timer = require "libs/hump/timer"
|
||||
Input = require "input"
|
||||
require "input"
|
||||
require "color"
|
||||
require "room"
|
||||
require "player"
|
||||
require "debug_helpers"
|
||||
|
||||
function love.load()
|
||||
_initDefaults()
|
||||
|
|
@ -33,17 +34,30 @@ function love.draw()
|
|||
currentRoom:draw()
|
||||
end
|
||||
|
||||
function _initDefaults()
|
||||
love.graphics.setDefaultFilter("linear", "nearest")
|
||||
function love.keypressed(key)
|
||||
if Input.isPlayerMove(key) then
|
||||
currentRoom:movePlayer(key)
|
||||
elseif Input.isPlayerSwitch(key) then
|
||||
local c = Input.playerColor(key)
|
||||
currentRoom:switchPlayer(c)
|
||||
end
|
||||
end
|
||||
|
||||
function _initDefaults()
|
||||
--set filter
|
||||
love.graphics.setDefaultFilter("linear", "nearest")
|
||||
|
||||
--set global width / height variables
|
||||
width = love.graphics.getWidth()
|
||||
height = love.graphics.getHeight()
|
||||
|
||||
if width > height then
|
||||
width = height
|
||||
else
|
||||
height = width
|
||||
end
|
||||
|
||||
--set randomseed
|
||||
math.randomseed(os.time())
|
||||
end
|
||||
|
||||
function _initGridVars()
|
||||
|
|
@ -57,4 +71,10 @@ end
|
|||
|
||||
function loadSprites()
|
||||
playerSprite = love.graphics.newImage("art/player.png")
|
||||
wallSprite = love.graphics.newImage("art/static_wall.png")
|
||||
boxSprite = {
|
||||
red = love.graphics.newImage("art/wall_r.png"),
|
||||
green = love.graphics.newImage("art/wall_g.png"),
|
||||
blue = love.graphics.newImage("art/wall_b.png")
|
||||
}
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue