2015-03-11 20:11:29 -04:00
|
|
|
require "entity"
|
|
|
|
|
|
2015-03-11 21:08:15 -04:00
|
|
|
Player = class("Player", Entity)
|
2015-03-11 20:11:29 -04:00
|
|
|
|
2015-03-15 08:00:59 -04:00
|
|
|
Player.static.sounds = {
|
|
|
|
|
switchFail = love.audio.newSource("sounds/switch_fail.wav"),
|
|
|
|
|
switchSuccess = love.audio.newSource("sounds/switch_success.wav")
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-15 15:34:17 -04:00
|
|
|
function Player:initialize(x, y, color)
|
2015-03-11 21:08:15 -04:00
|
|
|
Entity.initialize(self, {
|
2015-03-11 20:11:29 -04:00
|
|
|
x = x,
|
|
|
|
|
y = y,
|
2015-03-15 15:34:17 -04:00
|
|
|
color = color,
|
2015-03-12 03:04:09 -04:00
|
|
|
collision = "none", --player can't push other player
|
2026-08-07 01:05:08 -04:00
|
|
|
sprite = loadSprite("art/game/player.png")
|
2015-03-11 21:08:15 -04:00
|
|
|
})
|
2015-03-15 04:52:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Player:setActiveColors(colorArray)
|
|
|
|
|
self.activeColors = colorArray
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Player:getActiveColors()
|
|
|
|
|
return self.activeColors
|
2015-03-11 20:11:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Player:update()
|
|
|
|
|
|
2015-03-15 04:52:18 -04:00
|
|
|
end
|
|
|
|
|
|
2015-03-15 08:00:59 -04:00
|
|
|
function Player:playSwitchSound(success)
|
|
|
|
|
local sound
|
|
|
|
|
if success then
|
|
|
|
|
sound = Player.sounds.switchSuccess
|
|
|
|
|
else
|
|
|
|
|
sound = Player.sounds.switchFail
|
|
|
|
|
end
|
|
|
|
|
sound:stop()
|
|
|
|
|
sound:play()
|
|
|
|
|
end
|