Laser puzzle help

So I'm making a game with various puzzle elements in the dungeons. A lot of these have worked out fine, but there's one in particular where I'm just not sure how to go about it: a laser puzzle.

What the plan is:
- Laser is produced by an autorun event
- When the laser hits a mirror, it changes direction-- but only if it hits the reflective part of the mirror
- Pressing Z/Enter/A button next to a mirror rotates it 90 degrees clockwise from its current position
- When the laser hits a sensor object, a short scene plays where a door is opened and the lasers are deactivated
What I'm stuck on:
- How do I make the mirrors detect if they're reflecting a laser?
- How do I make the sensor detect if it's being hit by a laser?
- How do I display the laser? (tried using individual events for each tile the laser crossed, but it caused performance issues)

Please help me.
- How do I make the mirrors detect if they're reflecting a laser?
Should just be a series of variables and conditional branches. If mirror is positioned so and so, store direction into a variable and check whatever the next mirror is set at etc. Using the variables to read the direction for each mirror makes it easy to determine where the lasers should be visualised.

- How do I make the sensor detect if it's being hit by a laser?
As done above, at the end of the full sequence of conditional branches.

- How do I display the laser?
Using events shouldn't be causing any or much lag, unless it's something super huge, or you're playing on a potato, or your autorun event is doing stuff that it shouldn't be doing.
I have 2 idea's in mind that both works.

1) rotation detection is best used by variables
variable x = 0 (= DOWN),
variable x = 1 (= LEFT),
variable x = 2 = RIGHT
variable x = 3 = UP

this indicates the rotation on the laser projection.
than use event to project the laser in the direction, based on variable.

2) use long lasers and check direction a different way (facing left, right, up or down.
and continue from there.
You're speaking of "detecting" lasers and "reflect" them, but thats what you actually show and want the gameplay to demonstrate, is not the real eventing logic.

You just need the mirrors to have switches depending on the orientation (which can be done using a show choices or your original idea which would require saving orientation as a variable per mirror) and display the "reflected" light depending on the switches flipped on the mirrors (as "stepping" non interactable events, dont parallel them) so each "light" tile will be visible or not depending on these switches (which will correspond to the mirror orientation) so when the correct order of switches is on the puzzle will be solved.

Its the same logic as "activate levers in order" you're just showing a trail of light between the levers.

Try first with an L shape, just one mirror, the "goal" and the emitter, once this simple puzzle is played perfectly you can expand upon it and create a true mirror laser puzzle, just approach it from the makers eventing perspective.
You're speaking of "detecting" lasers and "reflect" them, but thats what you actually show and want the gameplay to demonstrate, is not the real eventing logic.

You just need the mirrors to have switches depending on the orientation (which can be done using a show choices or your original idea which would require saving orientation as a variable per mirror) and display the "reflected" light depending on the switches flipped on the mirrors (as "stepping" non interactable events, dont parallel them) so each "light" tile will be visible or not depending on these switches (which will correspond to the mirror orientation) so when the correct order of switches is on the puzzle will be solved.

Its the same logic as "activate levers in order" you're just showing a trail of light between the levers.

Try first with an L shape, just one mirror, the "goal" and the emitter, once this simple puzzle is played perfectly you can expand upon it and create a true mirror laser puzzle, just approach it from the makers eventing perspective.
Thanks! I just got it working. This issue can be closed now.

Original thread: https://forums.rpgmakerweb.com/threads/laser-puzzle-help.141085/