I
Ian
Guest
So im trying to do 360 degree turning in a sidescroller and stuck on finding the tip of the gun to shoot.
Found out since lengthdir funcs go off the canter point of the object i could just move the y offset in sprite editor to where i needed it do
Offset before:
Offset Changed to: (moved 2 pixels up, where the barrel is)
Changing the offset fixed it:
But much rather keep the y offset from before since it effects the gun rotation.
So how would i be able to find the guns point since i cannot simple use:
with that offset.
Code:
///[Step]Gun rotation
gun_angle = point_direction(x,y,mouse_x,mouse_y);
if(gun_angle > 90 && gun_angle < 270) gun_yscale = -1 else gun_yscale = 1;
image_xscale = gun_yscale;
Code:
///Draw event
//Player
draw_self();
//Gun
draw_sprite_ext(spr_uzi,0,x-(3*image_xscale),y+2,1,gun_yscale,gun_angle,c_white,1);
//End point
var xx = x+lengthdir_x(14,gun_angle);
var yy = y+lengthdir_y(14,gun_angle);
draw_sprite_ext(spr_pixel,0,xx,yy,1,gun_yscale,gun_angle,c_white,1);
Found out since lengthdir funcs go off the canter point of the object i could just move the y offset in sprite editor to where i needed it do
Offset before:
Offset Changed to: (moved 2 pixels up, where the barrel is)
Changing the offset fixed it:
But much rather keep the y offset from before since it effects the gun rotation.
So how would i be able to find the guns point since i cannot simple use:
Code:
//End point
var xx = x+lengthdir_x(14,gun_angle);
var yy = y+lengthdir_y(14,gun_angle);