• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Can you draw collision_line?

Evanski

Raccoon Lord
Forum Staff
Moderator
Like I want to have an enemy point a beam at you (collision_line) and then fire a bullet or something
but like how can I draw the collision_line as an actual line?
 

Yaazarai

Member
@IndianaBones it doesn't work that way. He's asking how to draw the line from x1,y1 to the point of collision x3,y3. For example you might have a line x1,y1 to x2,y2 however the point of collision is x3,y3.

The simplest solution would be to get the x,y position of the instance colliding with the line then draw the line from x1,y1 to the instance's position:
Code:
var inst = collision_line(x1,y1,x2,y3,Object,false,false)
draw_line(x1, y1, inst.x, inst.y);
However this doesn't give you the exact point of collision, just the position of the object being collided with so the actual collision line will be a bit off. This should be a good start though.
 
Top