Spawn bullet at barrel of gun
问题 I'm making a top-down shooter and the player's gun is offset from the coordinates of the object. I'm using GameMaker:Studio, so the x and y coords are the center of the object. The offset of the image is set here: bullet_offset_x = 30; bullet_offset_y = 28; And here is the code for shooting the gun: var xpos = x + (bullet_offset_x * cos(degtorad(direction))) - (bullet_offset_y * sin(degtorad(direction))); var ypos = y + (bullet_offset_x * sin(degtorad(direction))) + (bullet_offset_y * cos