How do I show an incoming enemy alert?

Get help using Construct 2

Post » Sat Aug 08, 2015 6:50 am

What I'm trying to reproduce is kind of what Jet Pack Joyride has in place. When an enemy, projectile, or anything harmful is incoming, an alert is shown on the screen in the direction the harmful thing is coming.

In this case, the alerts need are happening anywhere 360 degrees. How do I do this? Of course the alerts are going to appear on the HUD but how do I make them appear in the direction that the enemy is/will appear?
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Sat Aug 08, 2015 9:22 am

To get the angle between the player and the enemy you can use

angle(player.x,player.y,enemy.x,enemy.y)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Aug 08, 2015 1:30 pm

Either use line of sight or every tick as event, depending on how you want to do it. Then check for distance between object is less than a value. The in the action do what LittleStain wrote.
Image
B
14
S
4
Posts: 145
Reputation: 1,943


Return to How do I....?

Who is online

Users browsing this forum: guannstar and 17 guests