V
VMX
Guest
Hi guys,
I'm a beginner in game maker and I have my first real issue. I will try to explain it as simple as possible :
I want a tourret to shot 2 bullets (one at the right and the other at the left of my player object). Those 2 bullets will be connected with an electric line.
But I don't what direction I have to give in the bullet create event because the player object can move.
Someone told me to try with lenghtdir, I also read things about dsin and dcos but I still have no idea to create that.
This is the code I made to create an simple bullet :
Create event of my turret :
Step event of my bullet :
Can someone explain me how to do it correctly ?
Thanks in advance.
VMX
I'm a beginner in game maker and I have my first real issue. I will try to explain it as simple as possible :
I want a tourret to shot 2 bullets (one at the right and the other at the left of my player object). Those 2 bullets will be connected with an electric line.
But I don't what direction I have to give in the bullet create event because the player object can move.
Someone told me to try with lenghtdir, I also read things about dsin and dcos but I still have no idea to create that.
This is the code I made to create an simple bullet :
Create event of my turret :
Code:
if(irandom(100)==1)
{
instance_create_layer(x , y , "Instances", obj_bullet);
}
image_angle = point_direction(x,y,obj_player.x,obj_player.y)
}
Step event of my bullet :
Code:
speed = 9;
direction = point_direction(x,y,obj_player.x,obj_player.y)
image_angle = point_direction(x,y,obj_player.x,obj_player.y)
Thanks in advance.
VMX