[SOLVED] Light level - Tried older topics from here, no luck

Zedek

  • Posts: 20
Hi all,
 I'm making a small platforming game and so far this forum has been immensely helpful for solving issues or questions. I have a really fun idea (Which of course isn't super original) for my a set of levels - a torch in darkness.

I tried this tutorial after a lot of searching - https://www.youtube.com/watch?v=ii9aprIwd3w and it worked mostly! I made my player and torchlight actor the "player" as per the tutorial and a big yellow box actor for the illumination (which in the tutorial were small circles). Except the torch doesn't illuminate. So my player and the torch draw over the black box which is darkness, but the torch won't illuminate the background level.

Does anyone have any better tutorials or suggestions for something that worked for them? I can post more info if needed.

« Last Edit: June 12, 2022, 04:29:40 pm by Zedek »

merrak

  • *
  • Posts: 2711
The simplest technique I can think of is to have a screen-size all-black actor with a hole cut out of it. Keep the actor positioned so that the hole is centered over the player. Set the blend mode of the actor to achieve the desired effect.

If the only light source in the scene is the player, then this solution works. If you want shadows or multiple lights, you'll have to look into using the Image API or shaders.

Zedek

  • Posts: 20
Hi,

Thanks for the reply. It's a nice option but might start getting messy since I'm doing a torch like effect (Left, Right, Up, Down) .

I'll attach my actors. But So far I had working most of the techniques from the video I posted. Except the torch wouldn't illuminate the "Light".

The torch actor would show over the darkness which was another layer on the screen, as would my Actor.


merrak

  • *
  • Posts: 2711
I noticed that tutorial was from 2012. It was probably using some version of Stencyl 2.x. Using actors should still work, though. I can't tell what went wrong from the information you've given.

The Image API is much more flexible. You can use it to create multiple light sources and shadows. Unfortunately, I can't think of any quick tutorials that focus on lighting specifically--you could try asking on Discord. Luyren also has a YouTube channel with (recent) tutorials, including one on the Image API: https://www.youtube.com/watch?v=aAghaRSgY3o

Zedek

  • Posts: 20
Thanks! I'll check this out. Maybe  the box with cutout will work in the worst case.

But I hope this gives me some guidance for more options.

Zedek

  • Posts: 20
@merrak I wanted to show I had gone with your idea in the end.

I created an actor with a cut out hole, which follows my actor. I also had this actor create black boxes on all 4 sides to ensure no gaps. I didn't simply make the actor bigger because it would crash Stencyl :O

Thanks for the help. I'll attach my behaviors in case others see this.