Help with lighting!

For questions about using Classic.

Post » Thu Apr 10, 2014 1:45 am

Hi, I'm trying to make a top-down game where the player has a light object around him. I'm trying to make it so the player is unable to light up things like walls so he can't see the room next to him, but when I put wall objects together I get this jarring effect:

Image

Where one of the wall's shadows overlaps the other wall. Ideally I'd like to remove the shadowcaster effect for these walls specifically and just have it so the light terminates when it meets with a solid object, but I can't figure out how to do that. Help please?
B
2
Posts: 4
Reputation: 158

Post » Mon Apr 14, 2014 2:54 pm

One solution is to make the walls always show over-top of a shadow, then use a layer masking sprite to fake darkness in a circle around the player (like the Ghost Shooter tutorial/example that comes with CC)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,204
Reputation: 19,545

Post » Tue Apr 15, 2014 5:56 am

Thanks for the help :) Unfortunately I still can't make it achieve the desired effect. How would I make it so that walls are always showing on top of a shadow? I can't figure out how to do that, the Shadowcaster behavior for the wall only has enable/disable and set shadow depth as options.
B
2
Posts: 4
Reputation: 158

Post » Tue Apr 15, 2014 12:50 pm

Always -> (for each object?) set *shadowcaster* behind *wall*. Try this.
B
5
S
1
Posts: 37
Reputation: 576

Post » Tue Apr 15, 2014 6:46 pm

I still can't find the shadowcaster object in order to make that event. :( It must be because shadowcaster is a behavior and not an object.
B
2
Posts: 4
Reputation: 158

Post » Wed Apr 16, 2014 5:08 pm

Hmm it was a bit trickier than I remember, haven't used shadows in a while :P

Here's a cap file :) https://dl.dropboxusercontent.com/u/4714446/ShadowCasting.cap

Edit: To hide ones from other rooms, I would add this:

Private variable to each GameWall called "RoomNumber", and an invisible sprite over each room with the same private variable.

When player overlaps the room identifier (room check) object, set player private variable "CurrentRoom" to the objects' "RoomNumber"

Then, add events to say "if GameWall.Value('RoomNumber') = Player.Value('RoomNumber') then GameWall set visible" and otherwise set the GameWall to invisible

Hope that helps!
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,204
Reputation: 19,545

Post » Wed Apr 16, 2014 7:01 pm

That did the trick, thanks a lot!
B
2
Posts: 4
Reputation: 158

Post » Wed Apr 16, 2014 10:42 pm

Anytime :)
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,204
Reputation: 19,545


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests