Closed akarle closed 7 years ago
Serious progress in the above commit!
Torches are now held by the Hero object! Pressing t will activate the torch and expand the visibility of the character for 10 seconds. Basic functionality is there: you can't spam t, can't press it with no torches left, and torches show up in the inventory!
TODO:
Added torch item... still need to implement restrictions on having too many torches in your inventory (I'm thinking cap at 10).
Ok so a lot went down... First, in 50b5b86 I created a nice function which would basically remove the fog around the player as you went. It was optimized to only update the squares you've never seen before (and the square you are on, to move the 'x'), and it worked well!
But then in the shower I had this idea.. what if we could have a tail on the fog being removed? The idea seemed simple.. just add a setTimeout before you call the function of before.
But it was a flawed, half-baked, commit, and it led to #71, which was a bad bug because you could even remove yourself from the screen!
The solution here was to make each Timeout a property of each Location, such that when you moved (call to updateRoomHTML
, all the squares visible to the hero have any existing fogTimeout's cleared, and all positions no longer visible have a fogTimeout set such that in a certain amount of time (determined by the room's tier
) the fog creeps back in.
I like the idea a lot as a sort of "you lose your mind and memory as you go deeper".
But I'm closing this issue for now and leaving it to @mbkarle to work on scaling the fog tail to gameplay. Pretty proud of the code I generated by the final commit (01513ed) :) :)
Cheers, Alex
So late night thoughts--I think that it would be really fun to mess around with fog functionality now that I've moved all related functions to
Room.js
.From the introduction of my fog removal system (with
getValidNeighbors(avX,avY, flashlight)
) there has been the possibility for a flashlight / torch.I think it would be a really cool game feature:
Torches
torchOn
flag, which will be passed toremoveFog
.Other fog fun