Shadow caster and sprite/overlapping

For questions about using Classic.

Post » Mon Mar 28, 2011 9:11 pm

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:

*.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
B
3
G
2
Posts: 35
Reputation: 770

Post » Tue Mar 29, 2011 5:06 am

[color=#0000FF:bjl47qdr]- - Overlapping shadow:[/color:bjl47qdr]
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.)


[color=#0000FF:bjl47qdr]- - Round shadows coming from square objects:[/color:bjl47qdr]
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. :)
B
21
S
13
G
8
Posts: 306
Reputation: 5,458

Post » Thu Mar 31, 2011 6:15 pm

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

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
B
3
G
2
Posts: 35
Reputation: 770


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests