player done, old way
This commit is contained in:
parent
687939b269
commit
1156564fa2
4 changed files with 184 additions and 103 deletions
13
player.lua
13
player.lua
|
|
@ -7,15 +7,14 @@ Player.static.sounds = {
|
|||
switchSuccess = love.audio.newSource("sounds/switch_success.wav")
|
||||
}
|
||||
|
||||
function Player:initialize(x, y, activeColors)
|
||||
function Player:initialize(x, y, color)
|
||||
Entity.initialize(self, {
|
||||
x = x,
|
||||
y = y,
|
||||
color = "white",
|
||||
color = color,
|
||||
collision = "none", --player can't push other player
|
||||
sprite = playerSprite
|
||||
})
|
||||
self.activeColors = activeColors or {"red", "green", "blue"}
|
||||
end
|
||||
|
||||
function Player:setActiveColors(colorArray)
|
||||
|
|
@ -40,11 +39,3 @@ function Player:playSwitchSound(success)
|
|||
sound:stop()
|
||||
sound:play()
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue