Making Silhouettes for Objects Behind Obstructions

2

Attached Files

The following files have been attached to this tutorial:

.capx

silhouettestutorial.capx

Download now 177.91 KB

Stats

2,044 visits, 3,001 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 11 Jan, 2014. Last updated 19 Feb, 2019

Introduction:

I wrote this tutorial to help people make silhouettes for characters in their game who are obstructed behind obstacles. I tried searching the forums for a solution to this and no one had a solution when I asked. So I figured it would be best to make a tutorial for other people wishing to do what I did.

Setting it all up:

You will need the following.

1. A layer above the characters for silhouettes and obstructive objects.

2. Paster.

First off, go download Paster if you haven't yet. It has many advantages over Canvas, such as webgl support and it supports effects on objects pasted into it. Next place it in your layout and put it off screen at the size of 32x32. You may ask why this is, but it will come in handy for when you edit the layer with the silhouettes and obstructions because it won't get in the way constantly. It will be positioned and sized in your events however at the start of the layout. Also be sure to set it's blending effect to source atop otherwise none of this will work at all.

Now if you haven't already, make a layer for the silhouettes and obstructive objects. Make sure the Paster is ALWAYS on top on this layer. Also make sure this layer is directly above the layer your player and enemies are on. This will be your layer for objects like tunnels top objects that you can walk through, tree leaves that actors can walk behind and get obstructed by, etc. Now set the layer you just made to have force own texture turned on, otherwise this effect still won't work right.

Finally, you should probably have tinting effects or something similar for enemies and the player. For this example I made enemies appear completely red and the player appear completely green with the tint effect. You can do whatever you like however. Be sure to apply the effects you desire to the enemies and player. Also in this example, I made the Paster itself half opaque so the details of the obstructions can still be seen on the silhouettes.

That's pretty much all there is to it. Place your enemies, player and obstacles on the layer directly below the layer with the obstacle obstructions.

Events:

Now comes the programming.

This is relatively easy to setup. Make sure you set the Paster's size and resolution to the layer width and height. You might want to set the effects of the player and enemies to be as normal looking as possible so their effects don't show at the very start of the layout. Next I disabled the effects and set them to the appropriate parameters with an event testing for the start of the layout.

I set the updating event for every 0.021 seconds to cut down on processing time. It may not be updating in real time, but as long as your objects don't move insanely fast, the lack of updating will not be noticeable. This event first clears the Paster, enables the effect for the objects to have when pasted as silhouettes, then pastes them to Paster and disables the effects immediately after so the player never sees it happen.

.CAPX

silhouettestutorial.capx

Download now 177.91 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!