Spotlight Effect

kingdarkeyes

  • Posts: 11
Hello all! This is my first post to the Stencyl forums :P

But anyway, I am attempting to create a "dark" atmosphere in an upcoming game and I'm running in circles trying to implement it. The idea is to make the whole scene dark and have a light surround the player (in a layer mask type fashion). Thus far, I have been able to simulate the darkness by using the scene's drawing event. I set the color to black, the opacity to around 50% - 60%, and I fill the entire scene with a rectangle using this color. This works all fine and well but I have yet to find an actual solution for making the "spotlight" itself.

I have tried to draw a completely opaque circle over the main character (using his x and y location and the scene's drawing event), however, the circle does not center over the character as it should for some odd reason (might have something to do with the player's x/y not being relative to the scene's actual x/y values).I then attempted to make an actor that follows the player and tries to simulate this. This method produces very hazy results. I have also tried to use the main actor's drawing event to draw a circle around him, however it seems as though this has no effect on the actual scene's opacity around the character. Maybe I have a bit of a flawed understanding of how things are drawn in Stencyl, so this idea isn't translating very well to implementation.

Anyone know of a solution or has anyone done this effect themselves in Stencyl? Any help or tips are greatly appreciated as this effect is important to the game.

gruffman

  • *
  • Posts: 564
this Q comes up a lot. basically you need a solid black actor that has a transparent hole in it, that acts as the visible area to the player. as the player moves you need to move this actor with the player actor. make sure the giant black actor is always set to simulate/active.

have you checked the forge for similar? might be one on there
Now available for all Android Devices - Happy Face Concentration
My Games To Date
Find A Face / Hero Of Oda / Snakes And Ladders
Hungry Monkey available at fgl.com for Sponsorship
My site - Gruffgames.com

0ven

  • Posts: 19
The maze example game does this, you can see how they do it.

SadiQ

  • Posts: 1795
there's a Draw Light Radius actor behavior in the forge. That should do what you want.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.