G
guitarmonkeys14
Guest
Hey all, I am currently making a top/down 2D shooter and I am running into an issue.
I cannot make the spawn point of the bullet rotate with my character. I tried adjusting the X and Y of the "Jump To Point" in the bullets Create Event and got it to shoot out of the tip of the gun, but when I rotate my character it stays spawning at that same point. How do I set the bullet to spawn based off of a set point of the players sprite (i.e. the tip of the gun) regardless of player angle?
Alternatively I was wondering if there was something I could insert where I created the bullet after the "instance_create_layer("
Been stuck on this all day :/
Please help
I cannot make the spawn point of the bullet rotate with my character. I tried adjusting the X and Y of the "Jump To Point" in the bullets Create Event and got it to shoot out of the tip of the gun, but when I rotate my character it stays spawning at that same point. How do I set the bullet to spawn based off of a set point of the players sprite (i.e. the tip of the gun) regardless of player angle?
Code:
// Jump To Point
x += (image_angle +20);
y += (image_angle -95);
// Set Instance Rotation
image_angle += point_direction(x,y,mouse_x,mouse_y);
// Set Speed
speed += 6;
Alternatively I was wondering if there was something I could insert where I created the bullet after the "instance_create_layer("
Code:
// If Mouse Down
var l0248E0E1_0;
l0248E0E1_0 = mouse_check_button(mb_left);
if (l0248E0E1_0)
{
// Create Instance
newbullet = instance_create_layer(x + 0, y + 0, "Instances", obj_bullet);
// Assign Variable
newbullet.direction += image_angle;
}
Please help
Last edited by a moderator: