Have a bunch old game ideas collecting dust. I’ll never get to them, so I Thought I’d post some here for anyone to use however they wish.
TL;DR Whenever a target area is about to leave the screen quickly fade in your spooky object.
I think this idea is best understood with a concrete example, so I'm going to be using the cliche monster-in-the-mirror bit so we can understand each other better.
So visually it would work like this:
When I'm in the bathroom looking around slowly, nothing happens. Look in the mirror nothing happens. But if my look reaches a high enough velocity, so I know that the mirror will disappear off the screen in a fraction of a second, I fade my monster character onto/into the mirror so the player will only see the monster with their peripheral vision. When/if they look back there's no monster.
Mechanically:
For this you'll want some threshold on the outside borders of the screen that would determine the possible trigger range. You'll take the position of the mirror object and transform it to screen space to see if it's in the trigger threshold. If it is in the trigger area and the mouse velocity is high enough, trigger spooky event.
Another (probably more efficient) way to do it would be to just calculate the screen space position of the mirror and assume a continued average velocity over the previous n ticks and when the future projected position is greater or less than your screen resolution, trigger the event. Obviously include a sensitivity value so you can adjust it to your preferences.
Terrifying. Please nobody implement this in an actual game.