Dr_Nomz
Member
You know this sounds simple, but I have no idea where to begin. Basically I have this code:
And it works great for creating a bullet object that jumps to the pixels specified, but I kinda want to make it look nicer, by adding a line that follows between those points. So if the bullet travels 50 pixels forward, it'll leave a trail 50 px behind it. (a line)
How do I do this?
Also it would be really great if that line touches something then it runs the code to destroy itself and damage the object if necessary.
Code:
var shot, count, spread, shot_offset;
count = 1; // how many per shot
spread = 15; // how much spread
shot_offset = 25; //How far from the character the bullet(s) are created.
if (canshoot < 0){
canshoot = 0;
shot = instance_create(x+lengthdir_x(shot_offset,angle_1),y+lengthdir_y(shot_offset,angle_1),obj_Bullet);
shot.direction = angle_1 + (round(random(spread))) - spread*0.5;
shot.image_angle = shot.direction;
shot.speed = 40;
}
How do I do this?
Also it would be really great if that line touches something then it runs the code to destroy itself and damage the object if necessary.