Setting up a Radar

Get help using Construct 2

Post » Thu Feb 16, 2012 3:17 am

So, I'm trying to get an arrow to point in the direction of an enemy ship, but my radar is on a Layer with Parallax set to 0,0 for my HUD. It won't point towards an enemy if it's on a different Layer. If I move it to the layer the enemies are on, it scrolls off screen. I've tried to Pin and Anchor the arrow, but it either stutters, or doesn't stay where I put it. Is there a way around this? Is it possible to have the arrow point relative to the enemy to my ship? Any suggestions would be very helpful!
B
6
S
1
Posts: 37
Reputation: 774

Post » Thu Feb 16, 2012 3:50 am

Try saying this:

- Set Arrow angle to "angle(PlayerShip.X,PlayerShip.Y,EnemyShip.X,EnemyShip.Y)"

That way it shouldn't matter where the arrow is since it isn't part of the equation. Lemme know if it works!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Thu Feb 16, 2012 3:57 am

This worked EXACTLY as I needed it! Thanks so much! Also, where can I find a list of internals like that? I have some programming experience, and I have noticed I can use some class based functions (self.whatever), I guess that I missed some reading somewhere. Thanks again!
B
6
S
1
Posts: 37
Reputation: 774

Post » Thu Feb 16, 2012 3:59 am

No problem! The best place to find all kinds of handy features like that is in the manual right here on the site. For stuff like that angle expression, you'll want to read this page, system expressions:

http://www.scirra.com/manual/126/system-expressions

Browse around to your heart's content, there's a LOT of great info in there!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112


Return to How do I....?

Who is online

Users browsing this forum: Matthew de, semaso, Skebab, Virpoja and 24 guests