• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Making an in-game flashlight?

O

OQuixley

Guest
Hi everyone, I'm making a short horror game for my Design class, and wondering what the best way to implement a flashlight would be.
It's a very simple side-scroller, you can only move left or right. The protagonist has a flashlight, and it should be very simple to do.

But the only thing I can think of is to make a sort of triangular, yellow low opacity sprite to simulate the light, then making the sprite canvas massive, blacking out everything around the 'light' by filling it in with black, and tracking the sprite to the player's torch.
However I get the feeling this is not the ideal way to do it as the very large torchlight sprite may cause issues when running the game, I don't know.
I'm not going to make it that you can look around with the torch (with the mouse), just that you can look left or right with it. This should be a fairly simple thing to do but I can't really figure it out. I've been using Game Maker on and off for the last 2 years, and have gained a decent grasp of GML but I still have a lot to learn, especially when it comes to shading etc.

Hope this makes enough sense aha, hope someone can help :)

EDIT:
I also think it would be really cool if instead of just a sprite the lighting actually runs off some sort of system so that the beam widens or narrows depending on the distance to the edge of the room, as that'd look way more realistic, as at the moment the beam seems to go 'through' the wall somehow and it looks wrong.
 
Last edited by a moderator:
Top