Skip to content

Instantly share code, notes, and snippets.

@pancelor
Last active July 8, 2021 22:13
Show Gist options
  • Save pancelor/67bf8e7019044d8d76ed8a3d8b69c8c0 to your computer and use it in GitHub Desktop.
Save pancelor/67bf8e7019044d8d76ed8a3d8b69c8c0 to your computer and use it in GitHub Desktop.
Grouping Test (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Grouped Rules Tech Demo
author pancelor
homepage pancelor.com
again_interval 0.05
run_rules_on_level_start
(verbose_logging)
========
OBJECTS
========
_A
black
0000.
0..0.
0000.
0..0.
0..0.
_B
black
000..
0..0.
000..
0..0.
000..
_C
black
.000.
0....
0....
0....
.000.
_D
black
000..
0..0.
0..0.
0..0.
000..
_E
black
0000.
0....
000..
0....
0000.
_F
black
0000.
0....
000..
0....
0....
_G
black
.000.
0....
0.00.
0..0.
.000.
_H
black
0..0.
0..0.
0000.
0..0.
0..0.
_I
black
000..
.0...
.0...
.0...
000..
_J
black
...0.
...0.
...0.
0..0.
.00..
_K
black
0..0.
0.0..
00...
0.0..
0..0.
_L
black
0....
0....
0....
0....
0000.
_M
black gray
0..0.
0100.
01.0.
01.0.
01.0.
_N
black
0..0.
00.0.
0.00.
0..0.
0..0.
_O
black
.00..
0..0.
0..0.
0..0.
.00..
_P
black
000..
0..0.
000..
0....
0....
_Q
black gray
.00..
0..0.
0..0.
0.10.
.001.
_R
black
000..
0..0.
000..
0..0.
0..0.
_S
black
.000.
0....
.00..
...0.
000..
_T
black
000..
.0...
.0...
.0...
.0...
_U
black
0..0.
0..0.
0..0.
0..0.
.00..
_V
black gray
0..0.
0..0.
0.10.
.01..
.0...
_W
black
0..0.
0..0.
0..0.
0000.
00.0.
_X
black
0.0..
0.0..
.0...
0.0..
0.0..
_Y
black
0..0.
0..0.
.00..
..0..
.0...
_Z
black
0000.
..0..
.0...
0....
0000.
Background
lightbrown yellow
11111
01111
11101
11111
10111
Mover
blue
.000.
0...0
0...0
0...0
.000.
TrailL
blue
.....
.....
000..
.....
.....
TrailR
blue
.....
.....
..000
.....
.....
TrailU
blue
..0..
..0..
..0..
.....
.....
TrailD
blue
.....
.....
..0..
..0..
..0..
Wall
brown darkbrown
00010
11111
01000
11111
00010
Player
black orange white blue
.000.
.111.
22222
.333.
.3.3.
Button1
red gray
.111.
10001
10101
10001
.111.
Button2
red gray
.111.
10001
10101
10001
.111.
Button3
red gray
.111.
10001
10101
10001
.111.
ButtonDown1
lightgreen gray
.111.
10001
10001
10001
.111.
ButtonDown2
lightgreen gray
.111.
10001
10001
10001
.111.
ButtonDown3
lightgreen gray
.111.
10001
10001
10001
.111.
SolidWhite
white
SolidGray
gray
mStartup
transparent
=======
LEGEND
=======
. = Background
# = Wall
@ = Player
1 = Button1
2 = Button2
3 = Button3
s = mStartup
cLetter = _A or _B or _C or _D or _E or _F or _G or _H or _I or _J or _K or _L or _M or _N or _O or _P or _Q or _R or _S or _T or _U or _V or _W or _X or _Y or _Z
cSolid = SolidWhite or SolidGray
cButtonDown = ButtonDown1 or ButtonDown2 or ButtonDown3
cButton = Button1 or Button2 or Button3
cTrail = TrailL or TrailR or TrailU or TrailD
=======
SOUNDS
=======
sfx1 67975700
================
COLLISIONLAYERS
================
Background
mStartup
TrailR
TrailL
TrailU
TrailD
cButton
cButtonDown
Player, Wall
Mover
cSolid
cLetter
======
RULES
======
(create text labels)
right [mStartup][ | | | | | | Button1] -> [mStartup][SolidWhite | SolidWhite | SolidWhite | SolidWhite | | | Button1]
right [mStartup][ | | | | | | Button2] -> [mStartup][SolidWhite | SolidWhite | SolidWhite | SolidWhite | | | Button2]
right [mStartup][ | | | | | | Button3] -> [mStartup][SolidWhite | SolidWhite | SolidWhite | SolidWhite | | | Button3]
right [mStartup][ | | | | | | Button1] -> [mStartup][_N | _O | _N | _E | | | Button1]
right [mStartup][ | | | | | | Button2] -> [mStartup][_P | _L | _U | _S | | | Button2]
right [mStartup][ | | | | | | Button3] -> [mStartup][_L | _O | _O | _P | | | Button3]
[mStartup][Button1] -> [mStartup][Button1 ButtonDown1]
[mStartup] -> []
(activate buttons)
late [cButtonDown][Player cButton] -> [][Player cButton]
late [Player Button1] -> [Player Button1 ButtonDown1] sfx1
late [Player Button2] -> [Player Button2 ButtonDown2] sfx1
late [Player Button3] -> [Player Button3 ButtonDown3] sfx1
(remove stuff from last turn)
[Mover] -> []
[cTrail] -> []
(shoot the beam)
late [Player] -> [Player Mover]
(iff Button1 is down)
late right [ButtonDown1][Mover | no Wall] -> [ButtonDown1][TrailR | TrailL Mover]
late up [ButtonDown1][Mover | no Wall] -> [ButtonDown1][TrailU | TrailD Mover]
(iff Button2 is down)
late right [ButtonDown2][Mover | no Wall] -> [ButtonDown2][TrailR | TrailL Mover]
+late up [ButtonDown2][Mover | no Wall] -> [ButtonDown2][TrailU | TrailD Mover]
(iff Button3 is down)
startloop
late right [ButtonDown3][Mover | no Wall] -> [ButtonDown3][TrailR | TrailL Mover]
late up [ButtonDown3][Mover | no Wall] -> [ButtonDown3][TrailU | TrailD Mover]
endloop
==============
WINCONDITIONS
==============
=======
LEVELS
=======
message This tech demo visually shows how plus rules and starloop/endloop rules repeat in puzzlescript; Check out the hack link.
message Press the buttons to change which ruleset to use.
s.....################
......#.......#......#
......#########..#...#
......##...........###
......#1...........###
......#..............#
......#2.......#######
......#..@.....#.....#
......#3.......#.....#
......##.......#.....#
......################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment