34 lines
No EOL
712 B
Lua
34 lines
No EOL
712 B
Lua
require "entity"
|
|
|
|
Player = class("Player", Entity)
|
|
|
|
function Player:initialize(x, y, activeColors)
|
|
Entity.initialize(self, {
|
|
x = x,
|
|
y = y,
|
|
color = "white",
|
|
collision = "none", --player can't push other player
|
|
sprite = playerSprite
|
|
})
|
|
self.activeColors = activeColors or {"red", "green", "blue"}
|
|
end
|
|
|
|
function Player:setActiveColors(colorArray)
|
|
self.activeColors = colorArray
|
|
end
|
|
|
|
function Player:getActiveColors()
|
|
return self.activeColors
|
|
end
|
|
|
|
function Player:update()
|
|
|
|
end
|
|
|
|
function Player:draw()
|
|
for _, color in ipairs(self.activeColors) do
|
|
love.graphics.setColor(gColor[color]:set())
|
|
local p = self:getDrawPos()
|
|
love.graphics.draw(self.sprite, p.x, p.y, 0, drawScale, drawScale)
|
|
end
|
|
end |