Creating a switch that changes all objects in level

93 views
Skip to first unread message

jorgear...@gmail.com

unread,
Mar 15, 2017, 12:57:42 PM3/15/17
to PuzzleScript
I'm trying to make a game of mirrors and light, where you have to reflect light coming from a source to a portal to pass through the levels. Here is my source code:

http://www.puzzlescript.net/editor.html?hack=c7c9cd7c99b9fbb1b81b0a02653ef638

I want to make a switch (the Spinner object) that when pressed, makes all the static mirrors (SMirror) turn clockwise. However I have no clue how to make this. I've seen some examples that have one-one interaction between a switch and a door, but I haven't found something like this. What can I do?

Jamie Perconti

unread,
Mar 15, 2017, 3:52:11 PM3/15/17
to jorgear...@gmail.com, PuzzleScript
This can be done without too much trouble. Depending on how the switch is supposed to get activated, the beginning could work a couple of ways, so let's start at a point where there's an object called SwitchActive somewhere in the level, indicating that it's time to rotate the mirrors.

You'll need another dummy object to mark mirrors so they don't get rotated more than once; let's call that MirrorTurned. Then these rule templates should do what you need:

[SwitchActive] [Mirror1 no MirrorTurned] -> [SwitchActive] [Mirror2 MirrorTurned]
[SwitchActive] [Mirror2 no MirrorTurned] -> [SwitchActive] [Mirror3 MirrorTurned]
[SwitchActive] [Mirror3 no MirrorTurned] -> [SwitchActive] [Mirror4 MirrorTurned]
[SwitchActive] [Mirror4 no MirrorTurned] -> [SwitchActive] [Mirror1 MirrorTurned]

[MirrorTurned] -> []
[SwitchActive] -> []

If other rules depend on either of the marker objects, make sure to put the rules to remove them after all the other rules that need them, or just mark the rules removing them as "late".

Hope this helps!

Jamie

,


--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jorgear...@gmail.com

unread,
Mar 16, 2017, 11:40:12 AM3/16/17
to PuzzleScript, jorgear...@gmail.com, jamiep...@gmail.com
It worked perfectly. Thank you!
Reply all
Reply to author
Forward
0 new messages