Hi! This seems a very interesting issue, and since, unfortunately, Solarus cannot work with pixels yet, we would need a workaround. I agree that the best way would be to draw a sprite lots of times to draw the beam (maybe a square or dot of some color). I would like to collaborate with this script.
An interesting problem could be to script a beam with several colors or more details (for instance, a color for the border of the beam and other for the inner part of the drawing). Also, we could allow to customize (with some parameter of the script) the speed of the beams and the "lenght" of each beam, in case that the beam is discontinuous (although we can also script a "continuous" beam with an only straight line).
To summarize, I would allow to customize the following features on the script:
1-Color of the beam (and maybe border color too, or some detail.)
2-The beam could be a straight line or several traces. (Choose if the beam acts immediately or not in the first case. Choose the lenght and speed of beams in the second case.)
3-Allow the beam to collision, or not, with walls.
4-Allow to set a max distance (by default it could be "infinite").
5-Allow to customize the thickness of the beam.