How do I Create a radar with orbiting circles?

Get help using Construct 2

Post » Tue Jul 07, 2015 2:47 am

I want to make it where each circle around the player (on the blue circle) represents the direction a missile is coming from and as each missile gets closer each circle must increase in size.

I've only managed to create circles that orbit around the player when a missile is near and I got them to point in the direction of each missile. I did this using a sprite that sets its angle toward the missile.

The problem that I've run into is I don't know how to make it so that each circle is "spawned", chooses the right missile to represent, and deletes itself after the missile is destroyed. I also am not sure how to make the circle increase or decrease in size without messing up the origin.
Last edited by Aleyba on Thu Jul 09, 2015 10:30 pm, edited 1 time in total.
B
15
S
4
G
4
Posts: 58
Reputation: 3,064

Post » Tue Jul 07, 2015 5:22 am

Place dots on the circle like so:
x = Position + Radius * cos(Angle)
y = Position + Radius * sin(Angle)

Position will be the center of the circle (your player ship)
Radius is the size of the circle
Angle will be the angle between the circle and the missile. To get that, use angle(x1,y1,x2,y2)

When a missile is created, create a dot and give it a variable with the UID of the missile. Then use "pick by unique ID" to pair them. You can probably use a container instead if you want.

The size of the dots can be based on the distance between the dot and the missile using distance() and...er...range conversion, maybe. Using just distance() will make them smaller as the missiles get closer.

Hope that helps.
Image
B
242
S
29
G
13
Posts: 1,787
Reputation: 18,685

Post » Tue Jul 07, 2015 8:52 pm

Tokinsom wrote:Place dots on the circle like so:
x = Position + Radius * cos(Angle)
y = Position + Radius * sin(Angle)

Position will be the center of the circle (your player ship)
Radius is the size of the circle
Angle will be the angle between the circle and the missile. To get that, use angle(x1,y1,x2,y2)

When a missile is created, create a dot and give it a variable with the UID of the missile. Then use "pick by unique ID" to pair them. You can probably use a container instead if you want.

The size of the dots can be based on the distance between the dot and the missile using distance() and...er...range conversion, maybe. Using just distance() will make them smaller as the missiles get closer.

Hope that helps.


Thank you, this is actually a lot more practical than the way I was trying to accomplish it. I will try it.
B
15
S
4
G
4
Posts: 58
Reputation: 3,064


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 2 guests