Skip to content

Instantly share code, notes, and snippets.

@jcmiller11
Last active April 5, 2024 00:45
Show Gist options
  • Save jcmiller11/d2e8b16b9142aa5ee870d98a3fa84613 to your computer and use it in GitHub Desktop.
Save jcmiller11/d2e8b16b9142aa5ee870d98a3fa84613 to your computer and use it in GitHub Desktop.
Simple Block Sliding Game (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Simple Block Sliding Game
author jc
homepage www.puzzlescript.net
========
OBJECTS
========
Background
lightgreen green
11111
01111
11101
11111
10111
Wall
brown darkbrown
00010
11111
01000
11111
00010
Player
black orange white blue
.000.
.111.
22222
.333.
.3.3.
Crate
orange
00000
0...0
0...0
0...0
00000
LeftCrate
orange red
00100
01..0
11111
01..0
00100
RightCrate
orange red
00100
0..10
11111
0..10
00100
UpCrate
orange red
00100
01110
1.1.1
0.1.0
00100
DownCrate
orange red
00100
0.1.0
1.1.1
01110
00100
=======
LEGEND
=======
. = Background
# = Wall
P = Player
* = Crate
DirCrates = LeftCrate or RightCrate or UpCrate or DownCrate
Crates = DirCrates or Crate
=======
SOUNDS
=======
Crates move 36772507
================
COLLISIONLAYERS
================
Background
Player, Wall, Crate, DirCrates
======
RULES
======
(We can check if the turn is an again turn or not by seeing if
[moving Player] exists. This will not work in some more advanced
cases like games that use the realtime feature but it works here.
If no again is firing we replace all movement crates with regular ones.)
[moving Player] [DirCrates] -> [moving Player] [Crate]
(If the player is standing next to a crate and presses the direction
that faces into the crate, we replace the crate with a directional one
I put arrows on the direction marking ones but you could make them look
like a normal crate!)
LEFT [ LEFT Player | Crates ] -> [ LEFT Player | LeftCrate ]
RIGHT [ RIGHT Player | Crates ] -> [ RIGHT Player | RightCrate ]
UP [ UP Player | Crates ] -> [ UP Player | UpCrate ]
DOWN [ DOWN Player | Crates ] -> [ DOWN Player | DownCrate ]
(Make directional crates move one space and fire an again turn
again is "smart" so it will only continue while the crate can
move, it will not fire if all directional crates are blocked.)
[ LeftCrate ] -> [ LEFT LeftCrate ] again
[ RightCrate ] -> [ RIGHT RightCrate ] again
[ UpCrate ] -> [ UP UpCrate ] again
[ DownCrate ] -> [ DOWN DownCrate ] again
==============
WINCONDITIONS
==============
=======
LEVELS
=======
#############
#...*......*#
#....P....*.#
#......*....#
#*..*.......#
#......*....#
#############
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment