Well I have this glorious problem that my atan2 call in Java is acting up like little baby.
The situtation: We have a little game "window"/"lib" made up for us, and we are modifying/adding stuff to it for our class.
Now I have to program a helicopter that will run behind player, and no no collision checks are required(so no pathfinding either).
Everyone I know did it the naive (if Helli X < Player X) Helli X++; the same for Y. But this is shite.
I tried multiple times(past half hour) to tinker with atan2 in Java, and to no avail.
The problem isnt that Im stupid ass. The problem is that the coordinate system works in this way:
You have a rectangle area where you are placed when the game loads up, and the X axis is fine(-x ... 0 ... x), but Y axis is flipped, so it doesnt grow when going up, but it grows when going down
( 0
Y
)
And the atan2 is fucking up hard time(helli will only move in one axis if you are in third or first quadrant, the second one is a bit questionable, and it wont move at all if you are in fourth[by that I mean below it and to the right]).
Is there any way to make atan2 work or to convert the coords in any way to make it work?(I tried the obvious, negate the Y values, but that creates a some weird ass shit)
The situtation: We have a little game "window"/"lib" made up for us, and we are modifying/adding stuff to it for our class.
Now I have to program a helicopter that will run behind player, and no no collision checks are required(so no pathfinding either).
Everyone I know did it the naive (if Helli X < Player X) Helli X++; the same for Y. But this is shite.
I tried multiple times(past half hour) to tinker with atan2 in Java, and to no avail.
The problem isnt that Im stupid ass. The problem is that the coordinate system works in this way:
You have a rectangle area where you are placed when the game loads up, and the X axis is fine(-x ... 0 ... x), but Y axis is flipped, so it doesnt grow when going up, but it grows when going down
( 0
Y
)
And the atan2 is fucking up hard time(helli will only move in one axis if you are in third or first quadrant, the second one is a bit questionable, and it wont move at all if you are in fourth[by that I mean below it and to the right]).
Is there any way to make atan2 work or to convert the coords in any way to make it work?(I tried the obvious, negate the Y values, but that creates a some weird ass shit)