Offscreen Enemy Indicators
In this tutorial I'll show you how to create offscreen enemy indicators.
Click here for a demonstration.
We'll modify the Ghost Shooter tutorial example so open the examples folder from the start page and load up 'Ghost Shooter (tutorial version).capx'.
The first thing we'll do is create a new layer for the indicators. We'll call it 'Indicators' and place it between the 'Main' and 'UI' layers.
Double-click on the layout and insert a sprite called 'Indicator'.
Here is the image to use:
Now, onto the event sheet.
Events
First we'll delete the existing indicator at the start of the layout. Then we'll use a loop to create an indicator for each monster.
Add a new action to the 'On start of layout' event:
Then create a new sub-event and add the condition:
And the action:
We also have to make sure we create a new indicator whenever a monster is created and destroy one when a monster is destroyed.
We'll just destroy a random indicator when the monster is killed. Find the event where the monsters are destroyed and add a sub-event:
Add a system condition:
and a destroy indicator action same as in the 'On start of layout' event.
Create an indicator when a monster is spawned. Find the event where monsters are spawned and add a create monster action the same way as before.