chroma_solstice/player.lua
2026-08-07 20:56:55 -04:00

41 lines
804 B
Lua

require "entity"
Player = class("Player", Entity)
Player.static.sounds = {
switchFail = love.audio.newSource("sounds/switch_fail.wav", "static"),
switchSuccess = love.audio.newSource("sounds/switch_success.wav", "static")
}
function Player:initialize(x, y, color)
Entity.initialize(self, {
x = x,
y = y,
color = color,
collision = "none", --player can't push other player
sprite = loadSprite("art/game/player.png")
})
end
function Player:setActiveColors(colorArray)
self.activeColors = colorArray
end
function Player:getActiveColors()
return self.activeColors
end
function Player:update()
end
function Player:playSwitchSound(success)
local sound
if success then
sound = Player.sounds.switchSuccess
else
sound = Player.sounds.switchFail
end
sound:stop()
sound:play()
end