chroma_solstice/player.lua

34 lines
712 B
Lua
Raw Normal View History

2015-03-11 20:11:29 -04:00
require "entity"
2015-03-11 21:08:15 -04:00
Player = class("Player", Entity)
2015-03-11 20:11:29 -04:00
function Player:initialize(x, y, activeColors)
2015-03-11 21:08:15 -04:00
Entity.initialize(self, {
2015-03-11 20:11:29 -04:00
x = x,
y = y,
color = "white",
2015-03-12 03:04:09 -04:00
collision = "none", --player can't push other player
sprite = playerSprite
2015-03-11 21:08:15 -04:00
})
self.activeColors = activeColors or {"red", "green", "blue"}
end
function Player:setActiveColors(colorArray)
self.activeColors = colorArray
end
function Player:getActiveColors()
return self.activeColors
2015-03-11 20:11:29 -04:00
end
function Player:update()
end
function Player:draw()
for _, color in ipairs(self.activeColors) do
2015-03-15 07:08:35 -04:00
love.graphics.setColor(gColor[color]:set())
local p = self:getDrawPos()
love.graphics.draw(self.sprite, p.x, p.y, 0, drawScale, drawScale)
end
2015-03-12 04:05:39 -04:00
end