Bullet Direction, Trigonometric Functions, and atan

Get help using Construct 2

Post » Mon Mar 24, 2014 6:52 pm

I'm using atan to set the angle for a bullet. Unfortunately, it isn't behaving the way I expect. I thought that by determining the difference in x values of the target and the origin (and doing the same with the y values) I could get the opposite and adjacent sides of a triangle. From that I should be able to use atan to get an angle that references north as the 0/360 degree point. I then thought I could just subtract 90 degrees from that angle to orient the angle to Construct 2's technique of using east as the 0/360 degree point.
Well, this isn't working. My bullets seem to be going in the opposite direction they should be going. I've tried adding 180 and 270 degrees to see if that would have an affect, but it's not doing what I need it to do.
Before going down this path, I thought there'd be some action that would just let me launch a bullet towards an x,y coordinate, but I didn't see one.
Anybody know the solution?
Posts: 11
Reputation: 272

Post » Mon Mar 24, 2014 7:04 pm

That was a looong text. should just have read the last two lines :)

There is a action called "Set angle towards position" you can use that.

Something like this:

Posts: 347
Reputation: 4,451

Post » Mon Mar 24, 2014 7:41 pm

It never occurred to me to look outside the bullet behavior for an action that would make this happen. Thanks for the help.
Posts: 11
Reputation: 272

Return to How do I....?

Who is online

Users browsing this forum: ditocruz, uzumiapps and 26 guests