Advanced Shadows V2

Before I begin I want to say thank you to @thebrickccentric who made me think twice and suggested using the Enable behavior which saved this whole thing.

Thank you to @Galactian for his original Ray Cast addon bundles (I did modify it quite a bit, but it still has parts of the code)

Thanks to @DinoDev for being an amazing person.

And just so you don’t have to say it, thank you to myself.


Ok, that’s done.

And yes, the thumbnail does look better than in the game, but this is a coding showcase, not an art exhibit.

11 Likes

omg this is amazing, i love it

2 Likes


i don’t think it should look like this

2 Likes

NOTE: THE WALLS NEED TO HAVE A POSITION IN THEM SO THE COLLISION DOESN’T COMBINE

The Line object also has a specific animation.

1 Like

Wdym? If you think about it as possible line of sight from that angle it looks correct

1 Like

no, i mean like on the cover the light has kind of a gradient

1 Like

while in the game it’s just flat

1 Like

That’s just how Flowlab displays it. It does look cooler on the cover.

Btw a cool trick is if you have the background the same color as the walls

Screenshot 2022-09-21 10.46.19 AM

3 Likes


no light lol XD

1 Like

Did you just go off screen or did it bug?

1 Like

i went off screen, its not a bug lol

1 Like

You don’t mind if I used this example for my current project? (That is if my game lets me, lol)
I feel this would definitely increase the horror experience. Also I’m not sure if it would work for multiple walls sprites and doors.

Nvm, i realized there is way too much in my game that can would be in the way, lol. I want to have some sort of shadows, but with the mass amounts of different walls, doors, layering, spaghetti code, it probably wouldn’t be possible with the current set up I have now so I’ll have to think up of something.

2 Likes

Feel free to use it, I like helping others in any way possible. To make sure the collisions work on all the objects you want I would recommend setting the rays to Object A and then making Object A a parent to all the objects you want to activate the rays. (For anyone else reading this I would like credit if you do use it in your game)

1 Like

The only downside for my game is that the system you used has solid yellow lines to show the light on a black background as the darkness. I wanted to have it so that it cuts through the darkness to show what’s underneath. I also don’t want it to affect the walls to show the outline, but that means having to change the layer of walls. Then it has to hide enemies which are effected by layering of the walls. Like to show it behind or infront of. The pov of my game isn’t a try top down, but more at an angle which is gonna make it super difficult to pull off. I have a few ideas, but I’m too afraid to try, lol.

1 Like

You could experiment with the Blend behavior and see how that looks. Both ‘Add’ and Screen’ look good.

1 Like

Oh btw grazer recently added a new Message option to send to the last ray cast (I’m assuming this means the object the ray is hitting), so for the problem of the walls still being visible when they are not in “view” you could send a message telling those walls to be visible. I have no idea how this would affect performance though, so maybe it wouldn’t work.

1 Like

Since the POV is a little goofy and you are looking at the face, along with the top, of the horizontal walls, making this would be a bit difficult. I had the idea of making the vertical walls layer 20 (since they don’t affect anything anyway) and add a new object to mimic the top of the horizontal walls. So the wall outlines won’t be affected, but the face will, so you can’t see what’s on the walls, but you can see the shape of a room. Also by making it a high layer, the light could be layer 19, which should cover just about everything except the wall outlines. So the player can only see what’s within view.

Doors would be a bit tricky since they have to open and close. I thought of adding another object above the door that enables false or true depending on the status of the nearest door, which would allow the your vision to load in the room without the door getting in the way. This could work, but adding a ton of new objects will eventually break some other feature.

This was the main idea, which will take a bit to recreate, but it shouldn’t take too long, hopefully.

1 Like

Tomorrow I’ll probably add a slider to adjust the width of the Lines and the Length of the ray cast.

1 Like

Is there a way to allow it to collide with multiple objects instead of just one wall object? I’m gonna try hooking it up, so far so good. But I’m not for sure how most of the code works or what all I’m gonna end up doing wrong.

1 Like

So the way to make it collide with other objects is what I mentioned earlier.

The Rays collide with the Wall objects but not other objects. To fix this you can set the Parent of an object to the Wall and then it will set off the Ray Casts.

1 Like