Calculate the angle to fire to hit enemy

Get help using Construct 2

Post » Thu Jan 17, 2013 11:21 pm

@sqiddster The idea was to have a space ship that could move around freely. The player ship's turrets would shoot the enemy weapons if it got within a certain range. I was thinking of basing it on vector rather than speed, as the turrets didn't have movement (so to speak) even though they do move.

I've tried it with @Ashley / @Yanns code, but they all seemed to aim *dumb*.

If the ships were just moving I could base the speed, etc off of the ship... but as you said, it's the rotation that seems to mess things up.

This one got us beat?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 931
Reputation: 9,360

Post » Thu Jan 17, 2013 11:36 pm

It's certainly possible, but I'm not able to work out the formulae. I'm sure some of the math geniuses here could do it but it will certainly be difficult!
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Jan 18, 2013 10:37 am

Thanks for your help @sqiddster! I'll keep having a go, and will post if I have any luck!
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 931
Reputation: 9,360

Post » Tue Jun 09, 2015 12:56 pm

sqiddster wrote:Science!

It works rather well, if I may say so ;)
sqiddster2012-12-11 13:27:30


Hello I know it's been some time , but im working on something similiar to what you are describing and the dropbox link you provided seems to be dead (which is natural after so long). I was wondering if you can re-upload the above .capx (provided you still have it).

thanks you!
B
5
Posts: 3
Reputation: 233

Post » Tue Jun 09, 2015 2:33 pm

I did get this working in the end, but don't think I have an example. I could probably delve into the old program and have a look, unless the other guy replies with his link.

My finished game is here https://www.scirra.com/arcade/strategy-games/korelos-34

Doesn't work for me, I still get a white screen, but apparently it works for others. Fly out a bit and get some enemies to fire at you and you should see that they're fairly accurate, although everything is moving so they pretty much do a 'rough guess' I think.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Previous

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Justin1967, Lancifer and 29 guests