This commit is contained in:
0x81c 2015-03-11 20:11:29 -04:00
commit b4905845e6
148 changed files with 30049 additions and 0 deletions

45
player.lua Normal file
View file

@ -0,0 +1,45 @@
require "entity"
Player = class("Player")
function Player:initialize(x, y, color)
local entityTable = {
x = x,
y = y,
sizeX = 1,
sizeY = 1,
color = color,
collision = "none" --player can't push other player
}
Entity.initialize(self, entityTable)
--need to probably get rid of middleclass
--and roll yr own for default method inheritance
self.getDrawPos = Entity.getDrawPos
self.getGridPos = Entity.getGridPos
self.sprite = playerSprite
end
function Player:update()
end
function Player:draw()
love.graphics.setColor(self.color:set())
local p = self:getDrawPos()
love.graphics.draw(self.sprite, p.x, p.y, 0, drawScale, drawScale)
end
function Player:move(direction)
if direction == "up" then
self.gridY = self.gridY - 1
elseif direction == "down" then
self.gridY = self.gridY + 1
elseif direction == "left" then
self.gridX = self.gridX - 1
elseif direction == "right" then
self.gridX = self.gridX + 1
end
end