Shadow caster and sprite/overlapping

This forum is currently in read-only mode.
From the Asset Store
- This pack is suitable for shooting games, running games, platform games, and side-scrolling...
  • Hello,

    I need your help with understanding something: A shadow-caster behaviour slapped onto a sprite that is round, is using the boundary box for rendering the shadow. The boundary-box is quadratic. This makes the shadow also quadratic. How to change this?

    Is the only solution to make a specific collisionbox for each not-quadratic object that will draw a shadow?

    The other thing is: Why does the shadow of two shadow caster-objects overlap, as if they where on top of each other? Screenshot: <img src="http://dl.dropbox.com/u/12049513/screenshot_01.png">

    *.cap if someone wants to have a look: http://dl.dropbox.com/u/12049513/ZombiePanic.cap

    Please help me on this, it's driving me mad.

    Best regards,

    Noel

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
    • - Overlapping shadow:

    The way shadow casters and lights work is that the shadow casters essentially "paint" shadows into the light object's image. Therefore the shadows will be at the same z-order (front to back layering order) as the light casting them.

    So, if you want the shadows to appear underneath all the objects, then you need to send the light object to the back of the z-ordering. If you have multiple layers, then you need the light to be either at the back of the layer with the shadow Casters, or on a layer below the shadow Casters.

    (Note: To send an object to the back of the z-order, right click it and choose Order > To Back.)

    • - Round shadows coming from square objects:

    You have created a single barrel object, and you have placed 4 "instances" of that object in your level. You have also applied the "Shadow Caster" behavior to this one barrel object.

    So far so good.

    Here's where the problem arises.

    You have used a custom shadow collision shape for the shadows that this one barrel object will cast, but for your barrel object, you have created two different images stored in frame 1 and frame 2 of the animation strip. Frame 1 is a circular top view of a barrel, and frame 2 is a square side view of a barrel.

    If you create a custom shadow collision shape for your "Shadow_Clutter_Medium" object, it doesn't matter which frame of that object is showing, every "instance" will use that same shadow shape.

    To solve this, you'll need a unique object for each shadow collision shape you want to use.

    Hope that helps out.

  • Yeah, that did help me... I have now shadows that don't overlap anymore, thanks for that!

    It's a shame that I have to create a ton of shadow-caster elements to suit every not-quadratic element I use. I hope a better shadow-caster will be implemented in Construct 2, that would be a killer feat for me.

    Best regards,

    Noel

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