Created
June 19, 2022 16:18
-
-
Save jcmiller11/792234b7b98b5f9569c2a21fd45bc496 to your computer and use it in GitHub Desktop.
Edges Example (PuzzleScript Script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| title Edges Example | |
| author jcGyo | |
| homepage www.puzzlescript.net | |
| (IMPORTANT: The below directive allows us to run rules before the player performs any input) | |
| run_rules_on_level_start | |
| ======== | |
| OBJECTS | |
| ======== | |
| (It's grass! Boring, boring grass.) | |
| Background | |
| lightgreen green | |
| 11111 | |
| 01111 | |
| 11101 | |
| 11111 | |
| 10111 | |
| (Here's our dude, you may recognize this dude from the built in puzzlescript examples) | |
| Player | |
| black orange white blue | |
| .000. | |
| .111. | |
| 22222 | |
| .333. | |
| .3.3. | |
| (Here's an invisible marker! | |
| We're going to use it to make some rules only run on the first turn) | |
| FirstTurn | |
| transparent | |
| (Below are the markers we'll use to make our "false border" around the level | |
| To make edges invisible replace the following four sprites with | |
| TopEdge | |
| transparent | |
| BotEdge | |
| transparent | |
| LeftEdge | |
| transparent | |
| RightEdge | |
| transparent | |
| ) | |
| TopEdge | |
| red | |
| .0.0. | |
| 0.0.0 | |
| .0.0. | |
| 0.0.0 | |
| .0.0. | |
| BotEdge | |
| blue | |
| .0.0. | |
| 0.0.0 | |
| .0.0. | |
| 0.0.0 | |
| .0.0. | |
| LeftEdge | |
| yellow | |
| 0.0.0 | |
| .0.0. | |
| 0...0 | |
| .0.0. | |
| 0.0.0 | |
| RightEdge | |
| white | |
| 0.0.0 | |
| .0.0. | |
| 0...0 | |
| .0.0. | |
| 0.0.0 | |
| ======= | |
| LEGEND | |
| ======= | |
| . = Background | |
| (We're placing our FirstTurn marker on top of the player, this way it will be there when the level starts playing since I assume you're always going to have a Player object in all of your levels) | |
| P = Player and FirstTurn | |
| HorizontalEdges = TopEdge or BotEdge | |
| VerticalEdges = LeftEdge or RightEdge | |
| ======= | |
| SOUNDS | |
| ======= | |
| SFX0 43858302 (red sounds like fire) | |
| SFX1 78429705 (the blue bubbles like water) | |
| SFX2 36099700 (shiny gold) | |
| SFX3 80750909 (bird sound as they glide through the white clouds) | |
| ================ | |
| COLLISIONLAYERS | |
| ================ | |
| Background | |
| Player | |
| (All of our markers get put on their own layers, this way they won't interfere with each other's movement nor will they delete each other if placed on the same block) | |
| FirstTurn | |
| TopEdge | |
| BotEdge | |
| LeftEdge | |
| RightEdge | |
| ====== | |
| RULES | |
| ====== | |
| (If it's the first turn, place one of each edge marker on top of the first turn marker, which is also where the player is!) | |
| [FirstTurn] -> [FirstTurn TopEdge BotEdge LeftEdge RightEdge] | |
| (These rules will move each edge marker over to their corresponding edge. | |
| Since PuzzleScript rules are hungry each of these will continue firing until the edge is reached) | |
| UP [FirstTurn] [TopEdge |] -> [FirstTurn] [|TopEdge ] | |
| DOWN [FirstTurn] [BotEdge |] -> [FirstTurn] [|BotEdge ] | |
| LEFT [FirstTurn] [LeftEdge |] -> [FirstTurn] [|LeftEdge ] | |
| RIGHT [FirstTurn] [RightEdge|] -> [FirstTurn] [|RightEdge] | |
| (These two rules will duplicate each edge marker along the entire length of that edge) | |
| HORIZONTAL [HorizontalEdges|no HorizontalEdges] -> [HorizontalEdges|HorizontalEdges] | |
| VERTICAL [VerticalEdges |no VerticalEdges ] -> [VerticalEdges |VerticalEdges ] | |
| (Now we delete the FirstTurn marker, having finished our book keeping for the first turn we can get rid of it to make sure the above rules no longer execute on subsequent turns!) | |
| [FirstTurn] -> [] | |
| (These rules check if the player is on the edge marker and pushes in that direction. | |
| I'm going to use them to have different sounds play depending on which edge you bump into!) | |
| [UP Player TopEdge ] -> [Player TopEdge ] SFX0 | |
| [DOWN Player BotEdge ] -> [Player BotEdge ] SFX1 | |
| [LEFT Player LeftEdge ] -> [Player LeftEdge ] SFX2 | |
| [RIGHT Player RightEdge] -> [Player RightEdge] SFX3 | |
| ============== | |
| WINCONDITIONS | |
| ============== | |
| (The only true way to win the example is by mastering the techniques within) | |
| ======= | |
| LEVELS | |
| ======= | |
| ......... | |
| ......... | |
| ...P..... | |
| ......... | |
| ......... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment