Homing Lasers with Bending Sprites or Lines

Z

zackljones

Guest
So, I've created a weapon that fires homing lasers for this shmup project that I'm working on, and instead of having an object that leaves trails of dots behind as it travels, I wanted to know how to make it look like the homing lasers on Ikaruga or Crimzon Clover. Is there a way that I could create a laser sprite or a line that could bend towards the direction it's turning?
 
Z

zackljones

Guest
I don't know if you can bend a sprite but if you want a missile that constantly follows a target you can simply use move_towards_point() in the step event.

Hope I helped!
Yeah, I have the move_towards_point() down already. I'm just trying to make it look more appealing other than it just being a dot that leaves smaller dots behind as it travels. I wish I could show examples
 

Yal

šŸ§ *penguin noises*
GMC Elder
Is there a way that I could create a laser sprite or a line that could bend towards the direction it's turning?
  1. Make a sprite that's 1 pixel wide and [laser thickness] pixels tall, with its origin in the left center.
  2. Get a list of points you want the beam to pass through
  3. For each point,
    1. Get the direction and distance to the next point.
    2. Draw the laser-trail sprite with draw_sprite_ext such that
    3. its angle is equal to the direction to the next point,
    4. its xscale is equal to the distance to the next point
There'll be visible gaps if corners are too sharp, so you might want to make a "corner" sprite as well which is a circle with the same coloring you'd get if you'd rotate the laser 1px-wide sprite a full lap (so it'll blend together perfectly with a line of the beam), and its origin in the middle-centre. Add another loop that draws the corner sprite on every point first, and you should now have a much prettier line.
 
Top