Ever wished you could check for more than one condition at a time in Puzzle Script, like is there a bomb on the stage AND a destructible block? This tutorial teaches how to check multiple conditions. It assumes no prior programming knowledge except the previous Puzzle Script tutorials I have written.
Checking For Multiple Conditions
Open the sample project. Now add this code to your project:
late [Player Switch][DoorClosed] -> [Player Switch][DoorOpen]
The code follows this format:
[ Condition 1 ] [ Condition 2 ] -> [ Action 1 ] [ Action 2 ]
If condition 1 is true, and condition 2 is true, then do action 1 and action 2. In this case, condition 1 is checking if the Player is on a Switch. If he is, then condition 2 is checked, which is, is there a closed door anywhere in the level? If the check is true, then the DoorClosed object becomes a DoorOpen object, opening the door.
Say we want the door to close when the hero steps off the switch though, because we want the player to push a crate onto the switch to keep it open. You can write something like this:
late [Player | Switch][DoorOpen] -> [Player | Switch][DoorClosed]
If the player is standing next to a switch, and there is an open door anywhere in the stage, close the door. Finally, we want to keep the door open if we push a crate onto the switch:
late [Crate Switch][DoorClosed] -> [Crate Switch][DoorOpen]
Now the door will stay open when there is a crate on the switch.
Follow this blog for more tutorials on Puzzle Script, games development and updates on my projects.