• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows My bullet sprite is diagonal, I would like to rotate it so that it lines up with direction of shot.

K

Kaji_Ikaraseru

Guest
So I have made a sprite that is diagonal (view attached file) so every time I shoot, the bullet is rotated slightly to the left. How can I code it so that the tip of my bullet faces the way I am shooting?
 

Attachments

jo-thijs

Member
A direction of 0 is to the right.
Your sprite is directed to 45 degrees,
so you should do image_angle - 45 to make it perfectly align with image_angle.
 
K

Kaji_Ikaraseru

Guest
A direction of 0 is to the right.
Your sprite is directed to 45 degrees,
so you should do image_angle - 45 to make it perfectly align with image_angle.
Ok so that works when shooting to the right but when I shoot left, the bullet travels backwards. Wherever I shoot now my bullet is facing right while I want it to face the way I am shooting
 
K

Kaji_Ikaraseru

Guest
Ok so that works when shooting to the right but when I shoot left, the bullet travels backwards. Wherever I shoot now my bullet is facing right while I want it to face the way I am shooting
Nvm Fixed it using image_angle = point_direction(x , y, mouse_x, mouse_y)-45;
 
Top