Help with lighting!

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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:

    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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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)

  • 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.

  • Always -> (for each object?) set *shadowcaster* behind *wall*. Try this.

  • 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.

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

    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!

  • That did the trick, thanks a lot!

  • Anytime

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)