beamDir = scrModulo(2*mirrorCollision[i].image_angle - beamDir,360)
Here mirrorCollision[i] returns the (i+1)th id of the mirror that the beam collides with (there can be many mirror reflections in a row, like you see in the picture I posted). ScrModulo is just a basic modulo function with the exception that it handles negative values differently from GM's own modulo. For example, scrModulo(600,360) = 600 mod 360 = 240, but -60 mod 360 = -60 while scrModulo(-60,360) = 300 (returning argument0 to interval [0, argument1) ). Not sure if you need to use this new modulo function, but it worked in the context of my code.
A block that is laying horizontally has image_angle of 0 in my code, where are a straight vertical block has image_angle of 90, so you have to modify this a bit to fit your code, I suppose.
Note that this will not work for all edges of the rectangle. In Another Pathway (my game), the short edges of the mirror block won't reflect anything, but that's how I wanted it to be.
Edited by Koaske, 02 July 2012 - 09:55 PM.