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:
parent
85dd66b1e4
commit
ffa35aec89
6 changed files with 46 additions and 22 deletions
11
TODO
11
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?)
|
-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
|
-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'
|
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
|
||||||
1
door.lua
1
door.lua
|
|
@ -42,7 +42,6 @@ end
|
||||||
function Door:setColors(colors)
|
function Door:setColors(colors)
|
||||||
local offColors = {}
|
local offColors = {}
|
||||||
for color, off in pairs(colors) do
|
for color, off in pairs(colors) do
|
||||||
print(color, active)
|
|
||||||
if off then
|
if off then
|
||||||
if self.colors[color] then self.colors[color] = false end
|
if self.colors[color] then self.colors[color] = false end
|
||||||
table.insert(offColors, color)
|
table.insert(offColors, color)
|
||||||
|
|
|
||||||
16
player.lua
16
player.lua
|
|
@ -2,6 +2,11 @@ require "entity"
|
||||||
|
|
||||||
Player = class("Player", 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)
|
function Player:initialize(x, y, activeColors)
|
||||||
Entity.initialize(self, {
|
Entity.initialize(self, {
|
||||||
x = x,
|
x = x,
|
||||||
|
|
@ -25,6 +30,17 @@ function Player:update()
|
||||||
|
|
||||||
end
|
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()
|
function Player:draw()
|
||||||
for _, color in ipairs(self.activeColors) do
|
for _, color in ipairs(self.activeColors) do
|
||||||
love.graphics.setColor(gColor[color]:set())
|
love.graphics.setColor(gColor[color]:set())
|
||||||
|
|
|
||||||
38
room.lua
38
room.lua
|
|
@ -25,13 +25,12 @@ function Room:initialize(t)
|
||||||
red = true, green = true, blue = true
|
red = true, green = true, blue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- for color, coords in pairs(t.player) do
|
-- for color, coords in pairs(t.player) do
|
||||||
-- self.player[color] = Player:new(coords.x, coords.y, color)
|
-- self.player[color] = Player:new(coords.x, coords.y, color)
|
||||||
-- self.activeColors[color] = true
|
-- self.activeColors[color] = true
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
for i=1, 3 do
|
for i=1, 5 do
|
||||||
local x, y = randomPosition()
|
local x, y = randomPosition()
|
||||||
local door = Door:new(x, y, self.colorsPlayerHas)
|
local door = Door:new(x, y, self.colorsPlayerHas)
|
||||||
table.insert(self.doors, door)
|
table.insert(self.doors, door)
|
||||||
|
|
@ -41,12 +40,12 @@ function Room:initialize(t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- for i=0, 5 do
|
for i=0, 5 do
|
||||||
-- local x, y = math.random(1, gridWidth), math.random(1, gridHeight)
|
local x, y = randomPosition()
|
||||||
-- for color, active in pairs(self.activeColors) do
|
for color, active in pairs(self.activeColors) do
|
||||||
-- self.collideables[color]["w: " .. x .. ", " .. y] = Wall:new(x, y, color)
|
self.collideables[color]["w: " .. x .. ", " .. y] = Box:new(x, y, color)
|
||||||
-- end
|
end
|
||||||
-- end
|
end
|
||||||
|
|
||||||
for i = 0, 5 do
|
for i = 0, 5 do
|
||||||
local x, y = randomPosition()
|
local x, y = randomPosition()
|
||||||
|
|
@ -301,17 +300,22 @@ function Room:movePlayer(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Room:attemptPush(dirVector)
|
|
||||||
-- should return array of things to push or nil/falsey value
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function Room:switchPlayerColor(color)
|
function Room:switchPlayerColor(color)
|
||||||
if color == "white" then
|
local colors
|
||||||
self.player:setActiveColors({"red", "green", "blue"})
|
if color == "white" then colors = {"red", "green", "blue"} else colors = {color} end
|
||||||
else
|
|
||||||
self.player:setActiveColors({color})
|
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
|
end
|
||||||
|
if canSwitch then
|
||||||
|
self.player:setActiveColors(colors)
|
||||||
|
end
|
||||||
|
self.player:playSwitchSound(canSwitch)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Room:setActiveColor(color, bool)
|
function Room:setActiveColor(color, bool)
|
||||||
|
|
|
||||||
BIN
sounds/switch_fail.wav
Normal file
BIN
sounds/switch_fail.wav
Normal file
Binary file not shown.
BIN
sounds/switch_success.wav
Normal file
BIN
sounds/switch_success.wav
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue