Cast shadows on some surfaces, but not others

Get help using Construct 2

Post » Tue Sep 03, 2013 2:08 pm

Hi guys, I'm struggling to think of how to get this to work. I have a top-down space shooter game, and I want the ship to cast a shadow when over some surfaces - but not all.

The look I want is when the ship is moving over an asteroid, there should be a shadow, but when out in open space the shadow should be gone.

Any ideas? Perhaps I could do this with some sort of masking?
B
12
S
2
G
3
Posts: 86
Reputation: 2,960

Post » Tue Sep 03, 2013 2:27 pm

You can create an additional layer between the ship and asteroid. Create a shadow sprite (70% or so opacity) and pin it to the ship.
At beginning of layout -> [shadow sprite] is not visible
[shadow sprite] on collision with [asteroids] -> [shadow sprite is visible]

You can also use blend modes (assuming that your space background and the shadow are both black).
B
28
S
10
G
10
Posts: 97
Reputation: 6,584

Post » Tue Sep 03, 2013 2:51 pm

You can actually use blend modes without needing your space background to be entirely black.

here's a quick example I made. The asteroids and shadow are all on the 'shadowing' layer (with 'force own texture' set 'on'), and the shadow has a blend mode of 'source atop'.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,689

Post » Tue Sep 03, 2013 4:59 pm

Woah that's so simple, I would never have thought of using a blend mode for this. Thanks Sqiddster!
B
12
S
2
G
3
Posts: 86
Reputation: 2,960


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, dop2000 and 46 guests

cron