Making a very quick and very crappy game for a class project, but I can't figure out how to do this. The player is an object floating through a 2d space (eight directional) dodging a bunch of projectiles with occasional boss battles. I want the last two bosses to use a laser attack, which would aim at the player and stop the movement of the boss as well as block the player off from part of the map. (diagram here: http://prntscr.com/hbhcy6)
The way I was planning on accomplishing it was by making a laser that is always overlapping the player, but only became visible every 10 or so seconds. After 10 seconds, the laser would (slowly, if possible) become visible, the boss would stop moving, and the laser would stop tracking and just aim at where the player was last when the 10 seconds hit. When it was visible, it would deal damage when the player overlaps it. Then after firing for 3 or so seconds, the laser would go invisible, resume tracking, and the boss would start moving again.
An alternate plan was to have 2 objects constantly moving up and down either side that would stop and shoot a laser straight forward every now and then. By doing that, I would bypass having to come up with a way to make the laser track the player, but I don't know how to do that either apparently. The only way I can figure out how to do is is by making the two objects launch a "laser", which would look pretty bad but oh well, it's a class project. The problem is there doesn't seem to be a way to get the laser to stop for a few seconds once it hits the edge. At least, not when it's a launched object.
Help?