Skip to content

Instantly share code, notes, and snippets.

@raggy
Last active October 7, 2024 16:33
Show Gist options
  • Save raggy/ab70080823051b5ef648e11148ea637a to your computer and use it in GitHub Desktop.
Save raggy/ab70080823051b5ef648e11148ea637a to your computer and use it in GitHub Desktop.
Gelatinous Cube (Puzzlescript Plus Script)
Play this game by pasting the script in https://auroriax.github.io/PuzzleScript/editor.html
title Gelatinous Cube
author Benjamin Davis
again_interval 0.2
run_rules_on_level_start
runtime_metadata_twiddling
tween_length 0.05
========
OBJECTS
========
Background .
#1D2B53 #1D2B53
11010
11000
00110
10110
00000
Hole ~
black
Trigger o
#2a3b6a
.....
.000.
.000.
.000.
.....
Wall █
#7E2553
Gate #
#83769C
.0.0.
00000
.0.0.
00000
.0.0.
Player □
#00c37580 #00E436
00000
00100
00010
01000
00000
StickV ┃
#AB5236 #9c462b
..1..
..0..
..0..
..0..
..1..
StickH ━
#AB5236 #9c462b
.....
.....
10001
.....
.....
ArrowU
#C2C3C7 #AB5236 #FF004D
..0..
..1..
..1..
..2..
.....
ArrowD
#C2C3C7 #AB5236 #FF004D
.....
..2..
..1..
..1..
..0..
ArrowL
#C2C3C7 #AB5236 #FF004D
.....
.....
0112.
.....
.....
ArrowR
#C2C3C7 #AB5236 #FF004D
.....
.....
.2110
.....
.....
ArrowTrapU
#AB5236
.000.
0.0.0
..0..
.....
.....
ArrowTrapD
#AB5236
.....
.....
..0..
0.0.0
.000.
ArrowTrapL
#AB5236
.0...
0....
000..
0....
.0...
ArrowTrapR
#AB5236
...0.
....0
..000
....0
...0.
AttachedU
#AB5236
..0..
.....
.....
.....
.....
AttachedD
#AB5236
.....
.....
.....
.....
..0..
AttachedL
#AB5236
.....
.....
0....
.....
.....
AttachedR
#AB5236
.....
.....
....0
.....
.....
NotAttached
transparent
.....
.0.0.
..0..
.0.0.
.....
Supported
transparent
.....
...0.
0.0..
.0...
.....
Falling
#00000080
MovingU
transparent
.....
..0..
.0.0.
.....
.....
MovingD
transparent
.....
.....
.0.0.
..0..
.....
MovingL
transparent
.....
..0..
.0...
..0..
.....
MovingR
transparent
.....
..0..
...0.
..0..
.....
=======
LEGEND
=======
Stick = StickV or StickH
Arrow = ArrowU or ArrowD or ArrowL or ArrowR
ArrowV = ArrowU or ArrowD
ArrowH = ArrowL or ArrowR
ArrowTrap = ArrowTrapU or ArrowTrapD or ArrowTrapL or ArrowTrapR
Attached = AttachedU or AttachedD or AttachedL or AttachedR or NotAttached
AttachedV = AttachedU or AttachedD
AttachedH = AttachedL or AttachedR
Move = MovingU or MovingD or MovingL or MovingR
StopsPlayer = Wall or ArrowTrap
StopsStick = Wall or ArrowTrap or Stick or Arrow
StopsArrow = Wall or ArrowTrap or Stick or Arrow
FillsGate = Stick or Arrow
Carryable = Stick or Arrow
↑ = ArrowTrapU and ArrowU
↓ = ArrowTrapD and ArrowD
← = ArrowTrapL and ArrowL
→ = ArrowTrapR and ArrowR
=======
SOUNDS
=======
================
COLLISIONLAYERS
================
Background
Hole, Trigger, Wall, Gate, ArrowTrap
Stick, Arrow
AttachedU, AttachedL, NotAttached
AttachedD, AttachedR
Player
Supported, Falling
Move
======
RULES
======
( Create attached markers )
[ Stick no Attached ] -> [ action Stick ]
up [ action StickV | action StickV ] -> [ action StickV AttachedU | action StickV AttachedD ]
left [ action StickH | action StickH ] -> [ action StickH AttachedL | action StickH AttachedR ]
[ action Stick no Attached ] -> [ action Stick NotAttached ]
[ action Stick ] -> [ Stick ]
( Stop when we would walk into the void unsupported )
horizontal [ > Player Hole no StickH ] -> [ Player Hole ]
vertical [ > Player Hole no StickV ] -> [ Player Hole ]
horizontal [ > Player | Hole no StickH ] -> [ Player | Hole ]
vertical [ > Player | Hole no StickV ] -> [ Player | Hole ]
( Stop when we walk into something )
[ > Player | StopsPlayer ] -> [ Player | StopsPlayer ]
( Can't walk through a gate with something in it )
[ > Player | Gate FillsGate ] -> [ Player | Gate FillsGate ]
( Can't walk through a gate when carrying something )
[ > Player Carryable | Gate ] -> [ Player Carryable | Gate ]
( When carrying something and not walking over a hole, move it with us )
[ > Player Carryable no Hole | no Hole ] -> [ > Player > Carryable | ]
( If not walking over a hole, push things we walk into )
vertical [ > Player no Hole | StickH no Hole ] -> [ > Player | > StickH ]
horizontal [ > Player no Hole | StickV no Hole ] -> [ > Player | > StickV ]
vertical [ > Player no Hole | ArrowH no Hole ] -> [ > Player | > ArrowH ]
horizontal [ > Player no Hole | ArrowV no Hole ] -> [ > Player | > ArrowV ]
( Set off traps when stepping on a trigger )
late [ Player Trigger ] -> again
late [ Player Trigger ] -> again_interval 0.05
( Start arrow moving off triggered trap )
up [ stationary Player Trigger | ... | ArrowTrapD ArrowD ] -> [ Player Trigger | ... | ArrowTrapD < ArrowD ]
down [ stationary Player Trigger | ... | ArrowTrapU ArrowU ] -> [ Player Trigger | ... | ArrowTrapU < ArrowU ]
left [ stationary Player Trigger | ... | ArrowTrapR ArrowR ] -> [ Player Trigger | ... | ArrowTrapR < ArrowR ]
right [ stationary Player Trigger | ... | ArrowTrapL ArrowL ] -> [ Player Trigger | ... | ArrowTrapL < ArrowL ]
( Grab arrow movement from last turn )
up [ stationary ArrowU MovingU no Player ] -> [ > ArrowU ]
down [ stationary ArrowD MovingD no Player ] -> [ > ArrowD ]
left [ stationary ArrowL MovingL no Player ] -> [ > ArrowL ]
right [ stationary ArrowR MovingR no Player ] -> [ > ArrowR ]
( Clear invalid move tokens )
[ Move ] -> [ ]
( Stop arrow )
[ > Arrow | StopsArrow ] -> [ Arrow | StopsArrow ]
( Keep arrows moving next turn )
up [ > ArrowU ] -> [ > ArrowU > MovingU ] again
down [ > ArrowD ] -> [ > ArrowD > MovingD ] again
left [ > ArrowL ] -> [ > ArrowL > MovingL ] again
right [ > ArrowR ] -> [ > ArrowR > MovingR ] again
( Copy movement through attached markers to whole stick )
[ > Stick Attached ] -> [ > Stick > Attached ]
up [ orthogonal AttachedU | stationary AttachedV ] -> [ orthogonal AttachedU | orthogonal AttachedV ]
down [ orthogonal AttachedD | stationary AttachedV ] -> [ orthogonal AttachedD | orthogonal AttachedV ]
left [ orthogonal AttachedL | stationary AttachedH ] -> [ orthogonal AttachedL | orthogonal AttachedH ]
right [ orthogonal AttachedR | stationary AttachedH ] -> [ orthogonal AttachedR | orthogonal AttachedH ]
[ orthogonal Attached stationary Stick ] -> [ orthogonal Attached orthogonal Stick ]
( Stop stick when it bumps into something )
[ > Stick | stationary StopsStick ] -> [ Stick | StopsStick ]
( Stop stick from perpendicular movement through gate )
vertical [ > StickH Gate ] -> [ StickH Gate ]
horizontal [ > StickV Gate ] -> [ StickV Gate ]
vertical [ > StickH | Gate ] -> [ StickH | Gate ]
horizontal [ > StickV | Gate ] -> [ StickV | Gate ]
( Copy stop through attached markers to whole stick )
[ stationary Stick orthogonal Attached ] -> [ stationary Stick stationary Attached ]
up [ stationary AttachedU | orthogonal AttachedV ] -> [ stationary AttachedU | stationary AttachedV ]
down [ stationary AttachedD | orthogonal AttachedV ] -> [ stationary AttachedD | stationary AttachedV ]
left [ stationary AttachedL | orthogonal AttachedH ] -> [ stationary AttachedL | stationary AttachedH ]
right [ stationary AttachedR | orthogonal AttachedH ] -> [ stationary AttachedR | stationary AttachedH ]
[ stationary Attached orthogonal Stick ] -> [ stationary Attached stationary Stick ]
( Can't detach from a stick from the side )
(vertical [ > Player stationary StickH ] -> [ Player StickH ]
horizontal [ > Player stationary StickV ] -> [ Player StickV ])
( Can't pick up a stick from the side )
(vertical [ > Player | stationary StickH ] -> [ Player | StickH ]
horizontal [ > Player | stationary StickV ] -> [ Player | StickV ])
( Place supported markers to check if anything needs to fall )
late [ Supported ] -> [ ]
late [ Player no Hole ] -> [ Player Supported ]
late [ Stick no Hole ] -> [ Stick Supported ]
late up [ AttachedU Supported | AttachedV no Supported ] -> [ AttachedU Supported | AttachedV Supported ]
late down [ AttachedD Supported | AttachedV no Supported ] -> [ AttachedD Supported | AttachedV Supported ]
late left [ AttachedL Supported | AttachedH no Supported ] -> [ AttachedL Supported | AttachedH Supported ]
late right [ AttachedR Supported | AttachedH no Supported ] -> [ AttachedR Supported | AttachedH Supported ]
late [ Player no Supported ] -> [ Player Falling ] again
late [ Stick no Supported ] -> [ Stick Falling ] again
late [ Arrow Hole no Move ] -> [ Arrow Hole Falling ] again
late [ Falling ] -> again_interval default
( On next frame, drop unsupported pieces )
[ Player Falling ] -> [ Falling ]
[ Stick Falling ] -> [ Falling ]
[ Attached Falling ] -> [ Falling ]
[ Arrow Falling ] -> [ Falling ]
[ Falling ] -> [ ]
==============
WINCONDITIONS
==============
=======
LEVELS
=======
█████████
█.~...~.█
█.~.━━~.█
█.~.o.~.█
█.~□..~.█
█.~...~.█
█.~~~~~..
█.~~~~~.█
████↑████
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment