How do I use shadows to hide and reveal walls?

0 favourites
  • 4 posts
From the Asset Store
Wall Pin Board
$9.80 USD
30% off
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I've been trying a few different methods, but I am struggling to get the effect I'm aiming for.

    Does anyone know of a quick and simple way to convert this result:

    into:

    The key pieces I'm looking for is if the player can see a tile, that specific tile will be visible, however, if it can't be seen, I need it to vanish. At the moment, I am struggling to find a way to achieve this.

    Anyone cracked this?

    Edit - I should add that I am not using a tiledbackground in my game, but rather a tilemap that isn't a perfect square, drawn with an auto brush.

  • As an update to this, I have tried using line of sight to determine if I can actually see the object. However, seeing as I need the objects to cast a shadow, they are set to solid, and line of sight has literally no idea what object has blocked it.

    So if you make an object, then give it a solid behaviour, it blocks the line of sight, and the line of sight only recognizes if it sees an object if it can see the origin point.

    Very annoying.

  • I ended up with a result that sort of works, but it doesn't use the shadow plugin. Instead, it uses the drawing canvas to make a polygon of the shape I want.

    However, I now have the problem where it works great with a couple of objects, but when there are lots, it begins to slow down.

    In this example, there are only a few dozen, so it runs alright, but not great.

    In my actual game, there are 1000+ for it to work with.

    The problem I'm facing is that there seems to be literally no way to see if a line of sight can see an object unless I use a for each loop, which is what is causing my slow-down.

    Also, the line of sight only acknowledges that its seen an object if it manages to see the origin point of the object, which is driving me insane...

    At the moment, the code recognises that there is a wall behind the wall, and will try to reach it.

    I've attached my code. If someone could have a look and make it super efficient, it'd be appreciated!

    https://1drv.ms/u/s!AlZkRk7KfdFFjpY2rdHZ-Q3c20kh8Q?e=lVocou

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey mate, I was mucking around with this for a little while using the shadow behaviour and achieved a similar result to what you have currently and scales fairly well by comparison. Currently has 1000+ blocks, works a lot better with fewer!

    Still has some of the shortcomings you mentioned (and might not be enough of a performance boost with everything else on top) but I thought I would post it anyway.

    drive.google.com/file/d/1fBCLs5dIHqG3qMquzI-4TXbnZyA5GSXe/view

    Oops just realised I left the shadowlight light radius to 15, should be 0.

    I know you are wanting to cut the light through but here is a decent effect with fading imo if you are going to use blocks (probably useless to you but maybe good for someone else, lol).

    drive.google.com/file/d/17r5gt0LrzC-UNCGIFrcntpD00twE46z7/view

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