Get help using Construct 2

### » Fri Jun 08, 2012 10:27 am

Hi, this is one that has been giving me a headache. If anyone knows what it's called and I've missed the post please just tell me the name, but here's the problem anyway.

Here's the simplified version.
There's a slow target object moving through space at a randomly created but constant speed in a straight line.
I have an 'smartcannon' that will fire a projectile at this object whenever the player presses a button. The projectiles always go the same speed and in a straight line.
I want the projectiles to always hit these targets, but to do so only by changing the angle that it is fired at.

I've been trying to work out the Trig to predict a line ahead of the target and picking where the projectile will need to intersect to hit it but both the distances and times scale together.

I know the distance between starting points once the player hits the fire button and know they have to hit at the same time (given distance = time * speed)

Also I'm *really* trying not to give up and use point defense lasers or heat seeking missiles.
B
24
S
9
G
3
Posts: 34
Reputation: 4,799

### » Fri Jun 08, 2012 11:16 am

There's definitely a way to do this, you're probably just missing the algorithm a bit. Perhaps some of our math geniuses can help ;)
This would be nice for the FAQ, anyway.sqiddster2012-06-08 11:16:22
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

### » Fri Jun 08, 2012 11:33 am

@Ashley implemented this in CC as an expression.
The cap(not capx) attached in the link explains how it all works.
Might see if Ashley would add it to C2.

predictive aiming
B
179
S
50
G
207
Posts: 8,719
Reputation: 128,306

### » Sat Jun 09, 2012 6:09 am

Thankyou so much Newt, I'm downloading construct 1 now to have a look. I thought that was too fundamental to not have been tried before.
B
24
S
9
G
3
Posts: 34
Reputation: 4,799

### » Sat Jun 09, 2012 9:41 am

I decided to convert Aproximative Aim from .cap to .capx so i guess it had a bug, i think someone already reported it about angle.

http://flamma-beta.com//HTML5/aproxaim.capxJoannesalfa2012-06-09 09:42:15
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,426