WOWOWOWOWOWOWO WI DID IT WOWOWWWWWW WOW
This commit is contained in:
parent
286871ca21
commit
c668dc513b
7 changed files with 294 additions and 58 deletions
24
player.lua
24
player.lua
|
|
@ -2,18 +2,38 @@ require "entity"
|
|||
|
||||
Player = class("Player", Entity)
|
||||
|
||||
function Player:initialize(x, y, color)
|
||||
function Player:initialize(x, y, activeColors)
|
||||
Entity.initialize(self, {
|
||||
x = x,
|
||||
y = y,
|
||||
sizeX = 1,
|
||||
sizeY = 1,
|
||||
color = color,
|
||||
color = "white",
|
||||
collision = "none", --player can't push other player
|
||||
sprite = playerSprite
|
||||
})
|
||||
|
||||
self.red, self.green, self.blue = Color:new("red"), Color:new("green"), Color:new("blue")
|
||||
|
||||
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(self[color]:set())
|
||||
local p = self:getDrawPos()
|
||||
love.graphics.draw(self.sprite, p.x, p.y, 0, drawScale, drawScale)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue