player ca

Player.static.sounds = {
switchFail = love.audio.newSource(sounds/switch_fail.wav),
switchSuccess = love.audio.newSource(sounds/switch_success.wav)

}
This commit is contained in:
0x81c 2015-03-15 08:00:59 -04:00
parent 85dd66b1e4
commit ffa35aec89
6 changed files with 46 additions and 22 deletions

11
TODO
View file

@ -1,8 +1,13 @@
-write ruby script to output json table for processed art
-fix collision
FAILED -write ruby script to output json table for processed art
DOnE -fix collision
-flesh out full mythos, i.e.: where is the player, why is the player here, what is the player trying to get, who is here, what do they thin_ of the player's presence (are they happy? is the player an old face to them?)
-decide on dialog trees
-should puzzles be sort of secondary to exploration? li_e should most of the game be weird fun and interaction, and then the 'off the rails' parts should be puzzles???
YES -should puzzles be sort of secondary to exploration? li_e should most of the game be weird fun and interaction, and then the 'off the rails' parts should be puzzles???
all of the npcs should be stuc_ in a cycle of whatever they're doing, focused on it, hav always been focused on it, maybe it has to do w/ the fact that they are always doing 'night activities'
ma_e sprites static class vars instead of globals

View file

@ -42,7 +42,6 @@ end
function Door:setColors(colors)
local offColors = {}
for color, off in pairs(colors) do
print(color, active)
if off then
if self.colors[color] then self.colors[color] = false end
table.insert(offColors, color)

View file

@ -2,6 +2,11 @@ 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,
@ -25,6 +30,17 @@ 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())

View file

@ -25,13 +25,12 @@ function Room:initialize(t)
red = true, green = true, blue = true
}
-- for color, coords in pairs(t.player) do
-- self.player[color] = Player:new(coords.x, coords.y, color)
-- self.activeColors[color] = true
-- end
for i=1, 3 do
for i=1, 5 do
local x, y = randomPosition()
local door = Door:new(x, y, self.colorsPlayerHas)
table.insert(self.doors, door)
@ -41,12 +40,12 @@ function Room:initialize(t)
end
end
-- for i=0, 5 do
-- local x, y = math.random(1, gridWidth), math.random(1, gridHeight)
-- for color, active in pairs(self.activeColors) do
-- self.collideables[color]["w: " .. x .. ", " .. y] = Wall:new(x, y, color)
-- end
-- end
for i=0, 5 do
local x, y = randomPosition()
for color, active in pairs(self.activeColors) do
self.collideables[color]["w: " .. x .. ", " .. y] = Box:new(x, y, color)
end
end
for i = 0, 5 do
local x, y = randomPosition()
@ -301,17 +300,22 @@ function Room:movePlayer(key)
end
end
function Room:attemptPush(dirVector)
-- should return array of things to push or nil/falsey value
end
function Room:switchPlayerColor(color)
if color == "white" then
self.player:setActiveColors({"red", "green", "blue"})
else
self.player:setActiveColors({color})
local colors
if color == "white" then colors = {"red", "green", "blue"} else colors = {color} end
local canSwitch = true
local playerPos = self.player:getGridPos()
for _, color in ipairs(colors) do
if self:getCellInMatrix(self.collidableMatrices[color], playerPos) then
canSwitch = false
end
end
if canSwitch then
self.player:setActiveColors(colors)
end
self.player:playSwitchSound(canSwitch)
end
function Room:setActiveColor(color, bool)

BIN
sounds/switch_fail.wav Normal file

Binary file not shown.

BIN
sounds/switch_success.wav Normal file

Binary file not shown.