diff --git a/TODO b/TODO index 584f410..07ef9ab 100644 --- a/TODO +++ b/TODO @@ -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' \ No newline at end of file +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 \ No newline at end of file diff --git a/door.lua b/door.lua index 6e664de..df0e35a 100644 --- a/door.lua +++ b/door.lua @@ -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) diff --git a/player.lua b/player.lua index 9f355fd..2537b52 100644 --- a/player.lua +++ b/player.lua @@ -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()) diff --git a/room.lua b/room.lua index 40979c5..9e635c5 100644 --- a/room.lua +++ b/room.lua @@ -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) diff --git a/sounds/switch_fail.wav b/sounds/switch_fail.wav new file mode 100644 index 0000000..a5c8717 Binary files /dev/null and b/sounds/switch_fail.wav differ diff --git a/sounds/switch_success.wav b/sounds/switch_success.wav new file mode 100644 index 0000000..a941b2e Binary files /dev/null and b/sounds/switch_success.wav differ