OghuzKhan36Li
Member
Hi all,
I'm trying to draw a line up to the point of meeting a specific object.
The code I made snaps to the x and y coordinates of the wall it points to.. but I want the line to be drawn pointing to the mouse_x,y coordinates up until it meets the wall.
I'm trying to draw a line up to the point of meeting a specific object.
The code I made snaps to the x and y coordinates of the wall it points to.. but I want the line to be drawn pointing to the mouse_x,y coordinates up until it meets the wall.
GML:
//Create Event:
X = xstart;
Y = ystart;
randomize();
X2 = mouse_x+choose(-3, -2, -1, 0, 1, 2, 3);
Y2 = mouse_y+choose(-3, -2, -1, 0, 1, 2, 3);
Direction = point_direction(X, Y, X2, Y2);
//Draw Event:
X2 = lengthdir_x(1000, Direction);
Y2 = lengthdir_y(1000, Direction);
if collision_line(X, Y, X2, Y2, objWall, true, true) {
with (collision_line(X, Y, X2, Y2, objWall, true, true)) {
other.X2 = id.x;
other.Y2 = id.y;
};
};
draw_line_color(X, Y, X2, Y2, c_yellow, c_yellow);