Skip to content

Instantly share code, notes, and snippets.

@sfiera
Created September 15, 2020 04:02
Show Gist options
  • Save sfiera/65dadec49b2b00265bb67bee31fdcf5f to your computer and use it in GitHub Desktop.
Save sfiera/65dadec49b2b00265bb67bee31fdcf5f to your computer and use it in GitHub Desktop.
Destroy all blocks (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Destroy all blocks
author Chris Pickel
homepage www.puzzlescript.net
========
OBJECTS
========
Red
Red
RedCrate
Red
.....
.000.
.000.
.000.
.....
Green
Green
GreenCrate
Green
.....
.000.
.000.
.000.
.....
Blue
Blue
BlueCrate
Blue
.....
.000.
.000.
.000.
.....
Wall
Black
Player
White
.000.
.000.
00000
.000.
.0.0.
=======
LEGEND
=======
. = Red
R = RedCrate
G = GreenCrate
B = BlueCrate
# = Wall
@ = Player
Background = Red or Green or Blue
NonRedCrate = GreenCrate or BlueCrate
NonGreenCrate = BlueCrate or RedCrate
NonBlueCrate = RedCrate or GreenCrate
=======
SOUNDS
=======
================
COLLISIONLAYERS
================
Background
RedCrate
GreenCrate
BlueCrate
Player, Wall
======
RULES
======
(Push, but only visible crates, and only if there is an empty space on the far side)
[> Player | Red NonRedCrate | no Wall no NonRedCrate] -> [| Red Player | NonRedCrate]
[> Player | Green NonGreenCrate | no Wall no NonGreenCrate] -> [| Green Player | NonGreenCrate]
[> Player | Blue NonBlueCrate | no Wall no NonBlueCrate] -> [| Blue Player | NonBlueCrate]
(Else the player can move into a non-empty space, otherwise cancel)
[> Player | Red no Wall no NonRedCrate] -> [| Red Player]
[> Player | Green no Wall no NonGreenCrate] -> [| Green Player]
[> Player | Blue no Wall no NonBlueCrate] -> [| Blue Player]
[> Player] -> cancel
(Here is a slightly subtle part.
The action changes the color under the player, then everything changes to match.
The first rule can only apply once; if it could apply multiple times, then red would change to green, then green to blue, then blue to red, all in a single turn.
But a second rule is needed so that *all* the background tiles change)
[action Player Red] -> [Player Green]
[action Player Green] -> [Player Blue]
[action Player Blue] -> [Player Red]
[Player Background] [] -> [Player Background] [Background]
(Remove crates that can no longer exist)
[Red RedCrate NonRedCrate] -> [Red NonRedCrate]
[Green GreenCrate NonGreenCrate] -> [Green NonGreenCrate]
[Blue BlueCrate NonBlueCrate] -> [Blue NonBlueCrate]
==============
WINCONDITIONS
==============
No NonRedCrate on Red
No NonGreenCrate on Green
No NonBlueCrate on Blue
=======
LEVELS
=======
##..@
#..B.
..G..
.R..#
...##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment