require "entity" Player = class("Player", Entity) Player.static.sounds = { switchFail = love.audio.newSource("sounds/switch_fail.wav"), switchSuccess = love.audio.newSource("sounds/switch_success.wav") } 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:playSwitchSound(success) local sound if success then sound = Player.sounds.switchSuccess else sound = Player.sounds.switchFail end 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