Skip to content

Instantly share code, notes, and snippets.

@desplesda
Created December 16, 2018 01:37
Show Gist options
  • Save desplesda/e2153653196cf604c3713d117dd6f024 to your computer and use it in GitHub Desktop.
Save desplesda/e2153653196cf604c3713d117dd6f024 to your computer and use it in GitHub Desktop.
Button Squid (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Button Squid
author Jon Manning
homepage www.puzzlescript.net
again_interval 0.1
run_rules_on_level_start
========
OBJECTS
========
Background
#26f #37f
00000
01000
00000
00001
10000
(Background
LIGHTGREEN GREEN
11111
01111
11101
11111
10111)
Wall
darkgreen darkblue
01001
00100
00000
10101
01000
(Wall
BROWN DARKBROWN
00010
11111
01000
11111
00010)
Player
#5d7 yellow
.000.
.101.
.000.
00000
0.0.0
(Player
Black Orange White Blue
.000.
.111.
22222
.333.
.3.3.)
Coin
pink
.000.
000.0
00.00
0.000
.000.
DestroyedCoin
brown
.0.0.
0...0
.....
....0
..00.
PushBlock
darkblue lightblue
.000.
01110
01110
01110
.000.
MoveUp
purple pink
..0..
.010.
00000
..0..
.....
MoveDown
purple pink
.....
..0..
00000
.010.
..0..
MoveLeft
purple pink
..0..
.00..
0100.
.00..
..0..
MoveRight
purple pink
..0..
..00.
.0010
..00.
..0..
Exit
darkgreen lightgreen
.000.
00000
00100
00000
.000.
Bomb
#222 red
0.0.0
.000.
00100
.000.
0.0.0
BombPendingDetonation
#222 pink
0.0.0
.000.
00100
.000.
0.0.0
Absorber
green lightgreen #7f3
.000.
01210
02110
01120
.000.
Explosion
yellow
000.0
0.00.
00000
.00.0
00.00
SecondaryExplosion
brown
0.0.0
0..0.
.0000
00.0.
.0..0
MagnetUp
grey red
11.11
00.00
00.00
00000
00000
MagnetDown
grey red
00000
00000
00.00
00.00
11.11
MagnetRight
grey red
00001
00001
00...
00001
00001
MagnetLeft
red grey
01111
01111
...11
01111
01111
=======
LEGEND
=======
( Placeable objects )
. = Background
# = Wall
P = Player
* = Coin
B = PushBlock
U = MoveUp
D = MoveDown
L = MoveLeft
R = MoveRight
1 = MagnetUp
2 = MagnetRight
3 = MagnetDown
4 = MagnetLeft
X = Bomb
E = Exit
A = Absorber
(Categories)
MagnetBlock = MagnetUp or MagnetLeft or MagnetRight or MagnetDown
MoveBlock = MoveUp or MoveDown or MoveLeft or MoveRight
MovableBlock = PushBlock or MoveBlock or MagnetBlock
MagneticBlock = Bomb or MagnetBlock
AnyBlock = MovableBlock or Bomb or BombPendingDetonation
AnyMovable = MovableBlock or Player
Damage = Explosion or SecondaryExplosion
AnyDestroyable = Player or AnyMovable
=======
SOUNDS
=======
Player Move 38565907
sfx0 4917100 (Collect coin - we do it manually because we only want to play it when the player collects them, not when they're removed because of an explosion)
Explosion create 18649102
DestroyedCoin create 54605908
sfx1 11158101 (Player pushed object)
EndLevel 123413
================
COLLISIONLAYERS
================
Background
DestroyedCoin, Absorber
Exit, Explosion, SecondaryExplosion
Player, Wall, AnyBlock, Coin
======
RULES
======
( Players can collect coins )
[> Player | Coin ] -> [ | Player] sfx0 (play collect sound)
( Moving blocks continuously move until they hit something )
[ MoveUp ] -> [up MoveUp ] again
[ MoveDown ] -> [down MoveDown ] again
[ MoveLeft ] -> [left MoveLeft ] again
[ MoveRight ] -> [right MoveRight ] again
( Players can't push against a moving block in that block's travel direction)
down [down player | MoveUp] -> cancel
up [up player | MoveDown] -> cancel
left [left player | MoveRight] -> cancel
right [right player | MoveLeft] -> cancel
( Players can push blocks )
[> Player | MovableBlock ] -> [ Player | > MovableBlock ] sfx1
( Secondary explosions dissipate )
[ SecondaryExplosion ] -> []
( If an explosion overlaps a coin at the end of a turn, that coin is destroyed.
We special case coin destruction to produce DestroyedCoins,
so that we can prevent a win condition if any coins are destroyed. )
late [ Coin Damage ] -> [ DestroyedCoin Damage ]
( Bombs explode on the next turn when affected by an explosion at the
end of this turn.
This is done by turning a bomb into a BombPendingDetonation
at the end of this turn, and then on the next turn, that BombPendingDetonation
automatically turns into an Explosion.)
late [ Bomb Damage ] -> [ BombPendingDetonation ] again
[BombPendingDetonation] -> [Explosion]
( If, at the end of a turn, an explosion overlaps an object
that can be destroyed, that object is destroyed )
late [ AnyDestroyable Damage ] -> [ Damage ]
( Explosions create secondary explosions next to them )
[ | Explosion ] -> [ SecondaryExplosion | Explosion ] again
( At the end of a turn, explosions turn into secondary explosions
if there's a secondary explosion next to them )
late [ SecondaryExplosion | Explosion ] -> [SecondaryExplosion | SecondaryExplosion ] again
( Anything that pushes against a bomb causes it to detonate )
[ > AnyMovable | Bomb ] -> [ AnyMovable | Explosion ] again
( Anything entering an Absorber is destroyed )
[ AnyMovable Absorber ] -> [ Absorber ]
( Magnets pull bombs towards them )
down [ MagneticBlock | ... | stationary MagnetUp ] -> [ > MagneticBlock | ... | MagnetUp ] again
left [ MagneticBlock | ... | stationary MagnetRight ] -> [ > MagneticBlock | ... | MagnetRight ] again
right [ MagneticBlock | ... | stationary MagnetLeft ] -> [ > MagneticBlock | ... | MagnetLeft ] again
up [ MagneticBlock | ... | stationary MagnetDown ] -> [ > MagneticBlock | ... | MagnetDown ] again
==============
WINCONDITIONS
==============
No Coin
Some Player On Exit
No DestroyedCoin
=======
LEVELS
=======
( Intro to moving )
#####
#e#p#
#.#.#
#*.*#
#####
( Intro to pushables )
######
#..#.#
#.b*.#
#..#.#
#p.#e#
######
( Intro to bombs )
...###
...#*.
.b.x.*
...b*.
p..#.e
...###
( Intro to movables )
#.*xb..
....#.e
.p#.###
..u*###
#...###
( Chainable bombs )
##.*.p.**
.......**
rb...x.##
.....xxx.
##.*...#e
( Magnets )
e.#*...*#
..#..4..#
..#*...*#
..###x###
.*x....*l
.*x......
..#...#..
..#...up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment