Skip to content

Instantly share code, notes, and snippets.

@Draknek
Last active December 5, 2022 19:49
Show Gist options
  • Save Draknek/6a712522fdbbc3b124bef9a2dceb0e11 to your computer and use it in GitHub Desktop.
Save Draknek/6a712522fdbbc3b124bef9a2dceb0e11 to your computer and use it in GitHub Desktop.
Gem Magic (PuzzleScript Script)
Play this game by pasting the script in https://dario-zubovic.github.io/PuzzleScript/editor.html
title Gem Magic
author Alan Hazelden & Patrick Traynor
(verbose_logging)
case_sensitive
========
OBJECTS
========
Background
grey darkgrey
11111
11111
11011
11111
11111
FragileFloor
black darkgrey
01110
11011
10111
11101
01110
Hole
black
Falling
darkbrown
.....
.000.
.000.
.000.
.....
Target
darkblue
.....
.000.
.0.0.
.000.
.....
DestroyableWall
darkbrown darkblue
00010
11111
01000
11111
00010
InvincibleWall
darkbrown
PlayerNormal
DarkRed darkbrown #000000
..0..
.111.
01110
02220
.2.2.
PlayerCasting
DarkRed darkbrown #000000
..0.0
.1110
0111.
0222.
.2.2.
PushGem
lightgreen
..0..
.000.
00000
.000.
..0..
PullGem
lightgreen
.....
.000.
.000.
.000.
.....
ExplodeGem
red lightred
00000
01110
01010
01110
00000
FireballGem
red lightred
.....
.000.
.000.
.000.
.....
SplitGem
#dbc85f yellow
.010.
00100
11111
00100
.010.
SwapGem
lightblue blue
.000.
00000
01010
00000
.000.
CopyGem
lightgrey
.....
.000.
.000.
.000.
.....
WallDust
darkbrown
.....
...0.
.0...
.....
..0..
FireballDust
lightred
.....
...0.
.0...
.....
..0..
SplitDust
yellow
.....
...0.
.0...
.....
..0..
SwapDust
lightblue
.....
...0.
.0...
.....
..0..
ActivatedFromE
white
.....
.....
..0..
.....
.....
ActivatedFromW
white
.....
.....
..0..
.....
.....
ActivatedFromN
white
.....
.....
..0..
.....
.....
ActivatedFromS
white
.....
.....
..0..
.....
.....
BeamPathNS
white
..0..
..0..
..0..
..0..
..0..
BeamPathEW
white
.....
.....
00000
.....
.....
Influence
transparent
CheckFalling
transparent
=======
LEGEND
=======
. = Background
_ = Hole
- = FragileFloor
% = InvincibleWall
# = DestroyableWall
P = PlayerNormal
! = Target
A = PushGem
B = PullGem
O = ExplodeGem
X = FireballGem
S = SplitGem
W = SwapGem
C = CopyGem
1 = FireballDust
2 = SwapDust
3 = SplitDust
4 = WallDust
Activated = ActivatedFromE or ActivatedFromW or ActivatedFromN or ActivatedFromS
Player = PlayerNormal or PlayerCasting
player = Player
Gem = PushGem or PullGem or ExplodeGem or FireballGem or SplitGem or SwapGem or CopyGem
PushOrPullGem = PushGem or PullGem
BeamPath = BeamPathNS or BeamPathEW
Dust = WallDust or FireballDust or SplitDust or SwapDust
Wall = DestroyableWall or InvincibleWall
Movable = Player or Gem
Swappable = Player or PushGem or PullGem or ExplodeGem or FireballGem or SwapGem or CopyGem (split gem not swappable)
Obstacle = Movable or Wall
=======
SOUNDS
=======
================
COLLISIONLAYERS
================
Background
Target, Hole, FragileFloor
Dust
Player, Wall, Gem, Falling
Activated, BeamPath, Influence, CheckFalling
======
RULES
======
(cleanup from previous turn)
[ BeamPath ] -> []
[ Falling ] -> []
[ CheckFalling Movable Hole ] -> [ Falling Hole ] again
[ ActivatedFromE ] -> [ left ActivatedFromE ]
[ ActivatedFromW ] -> [ right ActivatedFromW ]
[ ActivatedFromS ] -> [ up ActivatedFromS ]
[ ActivatedFromN ] -> [ down ActivatedFromN ]
[ CheckFalling ] -> []
(activate gems: pusher/puller)
[ PushOrPullGem Activated | ] -> [ PushOrPullGem Activated | Influence ]
startloop
[ Influence Wall ] -> [ Wall ]
[ PushOrPullGem Activated | ... | Influence no Movable ] -> [ PushOrPullGem Activated | ... | > Influence ]
[ > Influence | ] -> [ | Influence ]
endloop
[ PushGem Activated | ... | Influence Movable | Obstacle ] -> [ PullGem CheckFalling | ... | Movable | Obstacle ]
[ PushGem Activated | ... | Influence Movable | no Obstacle ] -> [ PushGem Activated | ... | | Movable ]
[ PullGem Activated | Influence Movable ] -> [ PushGem CheckFalling | Movable ]
[ PullGem Activated | ... | no Obstacle | Influence Movable ] -> [ PullGem Activated | ... | Movable | ]
[ PushOrPullGem CheckFalling | ... | Movable Hole ] -> [ PushOrPullGem CheckFalling | ... | Movable CheckFalling Hole ]
[ Influence ] -> []
(activate gems: copy)
[ CopyGem Activated Dust ] -> [ action Dust ]
random [ CopyGem Activated | Gem ] -> [ CopyGem Activated | action Gem ]
[ CopyGem Activated | stationary Gem ] -> [ CopyGem | Gem ]
[ CopyGem Activated | action Gem ] -> [ Gem | Gem ]
[ action Gem ] -> [ Gem ]
[ CopyGem Activated ] -> [ CopyGem ]
(activate gems: fireball)
[ FireballGem > Activated | ] -> [ action FireballGem | > Influence ]
startloop
[ > Influence no Gem no Wall | no InvincibleWall ] -> [ | > Influence ]
endloop
[ > Influence ] -> [ stationary Influence ]
[ action FireballGem ] [ Influence Dust ] -> [ action Dust action Influence ] [ action Influence ]
[ action FireballGem ] -> [ action Influence ]
(activate gems: explosion)
startloop
[ ExplodeGem Influence | no Influence ] -> [ ExplodeGem Influence | > Influence ]
[ ExplodeGem Activated | ] -> [ ExplodeGem Activated | > Influence ]
[ | ^ Influence | ] -> [ Influence | Influence | Influence ]
endloop
[ Influence DestroyableWall ] -> [ Influence WallDust ]
[ Influence ExplodeGem ] -> [ Influence FireballDust ]
[ Influence FireballGem ] -> [ Influence FireballDust ]
[ Influence SplitGem ] -> [ Influence SplitDust ]
[ Influence SwapGem ] -> [ Influence SwapDust ]
[ Influence Gem ] -> []
[ Influence Player ] -> []
[ stationary Influence ] -> []
[ ExplodeGem Activated Dust ] -> [ action Dust ]
[ ExplodeGem Activated ] -> []
(fireball/explosion: turn dust into gems)
[ action FireballDust ] -> [ FireballGem ]
[ action SplitDust ] -> [ SplitGem ]
[ action SwapDust ] -> [ SwapGem ]
[ action WallDust ] -> [ DestroyableWall ]
[ action Influence Gem ] [ action Influence no Gem ] -> [ FireballDust ] [ Gem ]
[ action Influence DestroyableWall ] [ action Influence no Wall ] -> [ FireballDust ] [ DestroyableWall no Dust ]
[ action Influence ] -> [ FireballDust ]
(activate gems: swapper)
[ SwapGem Activated | ] -> [ SwapGem Activated | > Influence ]
startloop
[ > Influence Swappable ] -> [ action Influence Swappable ]
[ action Influence ] [ > Influence ] -> [ action Influence ] []
[ SwapGem Activated | ... | > Influence | ] -> [ SwapGem Activated | ... | | Influence ]
[ SwapGem Activated | ... | stationary Influence ] -> [ SwapGem Activated | ... | > Influence ]
endloop
[ stationary SwapGem Activated ] [ action Influence ] -> [ action SwapGem Activated ] [ Influence ]
[ action SwapGem Activated ] [ action Influence ] -> [ SwapGem no Activated ] []
[ action SwapGem ] -> [ SwapGem ]
[ SwapGem Activated ] [ Influence Swappable Dust ] -> [ stationary Swappable Dust ] [ SwapDust ]
[ SwapGem Activated ] [ Influence Swappable ] -> [ stationary Swappable ] [ SwapDust ]
[ SwapGem Activated ] -> []
[ Influence ] -> []
(activate gems: splitter)
[ SplitGem Activated | ] -> [ SplitGem Activated | > Influence ]
[ SplitGem < Activated | Influence ] -> [ SplitGem action Activated | ]
startloop
[ Influence Wall ] -> [ Wall ]
[ > Influence Gem ] -> [ action Influence Gem ]
[ action Influence ] [ > Influence ] -> [ action Influence ] []
[ SplitGem Activated | ... | > Influence | ] -> [ SplitGem Activated | ... | | Influence ]
[ SplitGem Activated | ... | stationary Influence ] -> [ SplitGem Activated | ... | > Influence ]
endloop
[ stationary SplitGem Activated ] [ action Influence ] -> [ action SplitGem Activated ] [ Influence ]
[ action SplitGem Activated ] [ action Influence ] -> [ SplitGem no Activated ] []
[ action SplitGem ] -> [ SplitGem ]
[ SplitGem Activated | ... | Influence Gem ] -> [ SplitGem > Activated | ... | Gem ]
left [ SplitGem > Activated | ] -> [ SplitGem | > ActivatedFromE ]
right [ SplitGem > Activated | ] -> [ SplitGem | > ActivatedFromW ]
up [ SplitGem > Activated | ] -> [ SplitGem | > ActivatedFromS ]
down [ SplitGem > Activated | ] -> [ SplitGem | > ActivatedFromN ]
[ Influence ] -> []
[ SplitGem action Activated ] -> [ SplitGem ]
(activate gems: others not yet implemented)
([ SplitGem Activated ] -> [ SplitGem ])
(toggle betwen player states)
[ action PlayerNormal ] -> [ PlayerCasting ]
[ action PlayerCasting ] -> [ PlayerNormal ]
left [ > PlayerCasting | ] -> [ PlayerNormal | > ActivatedFromE ]
right [ > PlayerCasting | ] -> [ PlayerNormal | > ActivatedFromW ]
up [ > PlayerCasting | ] -> [ PlayerNormal | > ActivatedFromS ]
down [ > PlayerCasting | ] -> [ PlayerNormal | > ActivatedFromN ]
(cast beam)
startloop
[ > Activated Gem ] -> [ Activated Gem ]
[ > Activated Wall ] -> [ Wall ]
random horizontal [ > Activated | ] -> [ BeamPathEW | > Activated ]
random vertical [ > Activated | ] -> [ BeamPathNS | > Activated ]
endloop
(pushing gems)
[ > Player | Hole ] -> [ Player | Hole ]
[ > Player FragileFloor ] -> [ > Player Hole CheckFalling ]
[ > Player | Gem ] -> [ > Player | > Gem ]
[ > Gem | Gem ] -> [ > Gem | > Gem ]
[ > Gem | Hole ] -> [ | Gem CheckFalling Hole ]
(end of turn cleanup)
late [ CheckFalling no Hole ] -> []
late [ Activated ] -> again
late [ BeamPath ] -> again
late [ Falling ] -> again
late [ CheckFalling ] -> again
==============
WINCONDITIONS
==============
all Player on Target
=======
LEVELS
=======
(%%!%%%%%%%%
%...%%%%%%%
%...%%%%%%%
%...%%%%%%%
###########
###########
###########
%%.OOO.W.%%
%%.......%%
%%..P....%%
%%%%%%%%%%%
%%%%________
%...________
!...________
%...________
%__#____.P._
%___..__..._
%__...___.__
%__.#......%
%__...O.A..%
%__%%......%
%%%%%%%%%%%%)
##############
##############
##.W....#....#
##.######....#
##.######....!
##.....##....#
##..X..#######
##.P...#######
##.....#######
##############
##############
%%%%%%%%%%%%
%%#########%
%%#..XXX..#%
!.#........P
%%#.......#%
%%#########%
%%%%%%%%%%%%
%%%!%%%
%.....%
%.....%
%.....%
%%###%%
%%###%%
%%.X.%%
%%PW.%%
%%.X.%%
%%%%%%%
%%%%!%%%%
%.......%
%.......%
%.......%
%#######%
%#######%
%..._...%
%.X._.X.%
%..._...%
%%%.P.%%%
%%%%%%%%%
%%%%%%%
!._...%
!._...%
%%%%..%
%..%__%
%..%.%%
%AP..%%
%..B.%%
%..%%%%
%%%%%%%
%%%%%%%%%%%%%%
%%%%_________%
%%%%_________%
%%%%__.....__%
%...__.....__%
!.A.__.....__%
%...__.....__%
%%%%__.S.W.__%
%%%%____.____%
%%%%____.____%
%%%%%%%%P%%%%%
______________P__
......__...__..._
.S..W.__.S.__.W._
......__X..__..._
......__...__###_
......__..W__..._
.S....__.S.__...!
......__...__..._
_________________
_.....__.....
_...S.__.....
_.....__X....
_.S.S.__..P..
_.....__.....
_________###_
__...____.X._
__..S____.S.!
__...____..._
_____________
%%%%%%%%%%%%%
%..._...%%..%
%.#.XX#.##..!
%..._...%%..%
%PX.__X_%%%%%
%..._...%%%%%
%.#._.B.%%%%%
%..._...%%%%%
%%%%%%%%%%%%%
####P########
####.########
#S_...###...#
#._X.X###...!
#S_.X.###...#
#############
#############
_!______________
..._..._S......S
...#.X._..S..S..
..._.S._S......S
____..._________
____..._____..._
____.W.#...#.W..
____...__.__..._
_________P______
_!______________
..._..._S......S
...#.X._..S..S..
..._.S._SXX..XXS
____..._________
____..._____..._
____.W.#...#.W..
____...__.__..._
_________P______
###!#######
###...#####
#####.#####
#####.#####
##.CCCCC.##
#....#....#
#.........#
#..##X##..#
##.......##
#####P#####
###################
###################
######.......######
######...X...######
#####C.......##...#
##....#####XX##...#
##...P#####O###...!
##.......######...#
##...W...######...#
##.......##########
###################
###################
%%%%%%%%%%%%%
%S.___.#.W..%
%_..._.%....%
%_.XX_.%....%
%_XX._.%....%
%_....P%..W.%
%_XX._.%....%
%_.XX_.%....%
%_..._.%....%
%S.___.#.W..%
%%%%%%#%%%%%%
%%%%%%#%%%%%%
%%%%%%#%%%%%%
%%%%%%#%%%%%%
%%%%%%!%%%%%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment