Need help with bullet trigonometry

D

Deity

Guest
Hi. i hm having issues with trigonometry in gamemaker studio, as it is nothing like it is in real life. i am trying to get bullets to fire at the player exactly 45 degrees off of where they are, as shown in this image here:

Any other info needed just ask
 

Kepons

Lost The Bet
You can get the direction from the enemy to the player with point_direction(). Then, add or subtract 45 to that.

Edit: As for trigonometry, it works very much like anywhere else. I'm just guessing, but sin(), cos() and similar functions have counterparts starting with d (dsin(), dcos() etc.) The difference is that the former takes a value in radians and the latter in degrees, so you might be using the wrong ones somewhere.
 
D

Deity

Guest
Hi. i hm having issues with trigonometry in gamemaker studio, as it is nothing like it is in real life. i am trying to get bullets to fire at the player exactly 45 degrees off of where they are, as shown in this image here:

Any other info needed just ask
Having this in bullet object:
direction = point_direction(x,y, oChar.x, oChar.y) + dir;
speed = sp;
and this in the enemy that created it:
a=instance_create(x,y,oEBulletDir);
a.dir = 35;
a.sp = 3;
has worked!

Thank you to all who answered.
 
Top