Offscreen Enemy Indicators

Favourite 14 favourites
Tutorial written by ramonesOriginally published on 21st, July 2012 - 8 revisions

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.

Comments

0
Astro 5,657 rep

Nice tutorial ramones, very insightful.

Saturday, July 21, 2012 at 6:14:04 PM
0
Joannesalfa 15.1k rep

Awesome tutorial, this is very good solution to make indicators!

Sunday, July 22, 2012 at 12:16:42 AM
0
InvaderX 5,421 rep

Awesome! Thanks.

Friday, August 17, 2012 at 11:42:01 PM
0
InvaderX 5,421 rep

Hey, there is a weird glitch where the indicators get stuck and dont stay on screen.

Friday, August 24, 2012 at 9:53:40 PM
0
farflamex 4,999 rep

Thank you, I needed this for my game. Good stuff.

Tuesday, November 06, 2012 at 3:07:19 AM
0
SysDiman 3,729 rep

Nice & helpfull, big tnx!

Tuesday, January 15, 2013 at 2:34:28 PM
0
Cereal Killa 2,375 rep

So won't the arrows just appear at the same x and y values as the mobs?

Wouldn't it be better to draw a line between the player and the mob and where the line intersects the border, you draw an arrow pointing towards the mob?

Of course you don't have to draw an actual line (you could just use maths), but that is the principle.

Monday, February 25, 2013 at 11:18:19 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.