Cast shadows on some surfaces, but not others

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

  • Try Construct 3

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

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

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

  • Woah that's so simple, I would never have thought of using a blend mode for this. Thanks Sqiddster!

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