I’m making a game similar to Mirror but with more story-driven gameplay.
One aspect of the game I’m not too happy with at the moment is the ‘fear events’. When you stare into the mirror with the lights off, stuff start happening the longer you stare into it.
At the moment, the events I’ve got are hardcoded if statements for when the fear level reaches a certain level.
Ideally, I would like the events to be entirely random. There’s a mirrored version of the map as-well as a mirrored version of the player which follows the player’s movements so I would like to be able to randomly effects parts in the mirrored version and how ‘severe’ it changes them increases the higher the fear level is.
How would I go about starting to create a system like this?
This thread does not belong in Code Review. Please read the guidelines of the category before creating a thread. If it does belong here, please read the guidelines anyway as your post does not include sufficient information or resources to constitute as a proper Code Review thread.
Code Review is specifically for improving already-working code, not refactoring or creating a new codebase altogether - those kinds of threads belong in Scripting Support.
I would try using math.random() to coordinate the timing of said events, but supplement that with some conditionals.
while wait(math.random(50,100)) do
if playerislookingatstatue() == true and not playerisdead() then
while true do
if math.random(1,15) == 15 then
what I see good horror games do a lot is really subtle sounds which are triggered by moving past a certain point. To make this behavior even more unpredictable you could make a certain chance of the spook not triggering.
if math.random(1,5) == 5 then -- walking past the point wont always trigger it, so they can't expect anything
using random numbers is the way to go, because unpredictable spooks are more creepy than very obvious/expectable spooks
in the mirror game, this is essentially what happens:
if player is looking at mirror, sequence starts
if player stops looking at mirror, sequence stops until looking is resumed
You could have a series on event that are possible after a specific threshold. From what I understand you are saying you do each one at a specific point once they hit a specific amount. Why not just add the available once to a random table?
Say you hit 100 seconds looking into the mirror, why not add a new event to a table of already available ones. Then, randomly pick the event from this table, you can decide how random you want this to be and if you want a pattern and etc…