Skip to content

Instantly share code, notes, and snippets.

@jamesamiles
Created June 19, 2018 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesamiles/9bd3b639ce3fec9dc810eb03f4468e77 to your computer and use it in GitHub Desktop.
Save jamesamiles/9bd3b639ce3fec9dc810eb03f4468e77 to your computer and use it in GitHub Desktop.
Train (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Train
background_color black
verbose_logging
========
OBJECTS
========
Background
Black Darkgray
00000
00000
00100
00000
00000
Wall
Black
00000
00000
00000
00000
00000
Player
Red
.000.
0.0.0
00000
.000.
.000.
Cart
Green Gray
00.00
00000
.0.0.
00000
00.00
Cart_Trail
Lightgreen
00000
00000
00000
00000
00000
Horizontal_Track
Gray
00000
.....
.....
.....
00000
Vertical_Track
Gray
0...0
0...0
0...0
0...0
0...0
Cross_Track
Gray
0...0
.....
.....
.....
0...0
Pad
Red
.....
.0.0.
..0..
.0.0.
.....
Pad_Pressed
Yellow
.....
.0.0.
..0..
.0.0.
.....
Pad_Active
Green
.....
.0.0.
..0..
.0.0.
.....
Gate
DARKBROWNYellow
00000
0.0.0
0.0.0
0.0.0
00000
Goal
Green Black
.....
.000.
.010.
.000.
.....
Temp
TRANSPARENT
Stay
TRANSPARENT
Spawn_Cart
TRANSPARENT
=======
LEGEND
=======
. = Background
- = Horizontal_Track
l = Vertical_Track
+ = Cross_Track
0 = Pad
_ = Pad and Horizontal_Track
I = Pad and Vertical_Track
T = Pad and Cross_Track
# = Wall
P = Player
C = Cart
G = Gate
X = Goal
Inactive_Pad = Pad or Pad_Pressed
track = Horizontal_Track or Vertical_Track or Cross_Track
hidden = Cart_Trail or Spawn_Cart
top = Player or Cart or Wall or Gate
=======
SOUNDS
=======
sfx0 60488706
sfx1 46219306
endlevel 25932900
================
COLLISIONLAYERS
================
Background
Temp
Pad, Pad_Pressed, Pad_Active
Goal
hidden
track
top
Stay
======
RULES
======
(* Time Passes Only When Player Moves or Action Is Pressed *)
(Keep track of where Player is, unless action is pressed)
[Stay] -> []
[Player] -> [Player Stay]
[action Player Stay] -> [action Player]
(* Push Carts *)
(Player pushes Cart if Cart is not blocked)
[> Player | Cart] -> [> Player | > Cart]
[> Player | > Cart | Top] -> [Player | Cart | Top]
(* Move Carts Along The Track *)
(An unpushed Cart on a Track will spawn new Carts on neighboring Track)
(Carts cannot spawn where there are objects or Cart_Trails)
[Stationary Cart Track| Track no Top no Cart_Trail] -> [Stationary Cart Track| Track no Top no Cart_Trail Spawn_Cart]
(Clear all Cart_Trails)
[Cart_Trail]-> []
(Turn all unpushed Carts into Cart_Trails)
[Stationary Cart Track] -> [Cart_Trail Track]
(Spawn new Carts)
[Spawn_Cart] -> [Cart]
(* Are All Pads Covered By Crates? *)
(While Temp exists, maybe all Pads are covered by Crates)
late random [] -> [Temp]
(If there is some Pad that has no Cart, then not all Pads are covered)
late [Temp][Inactive_Pad no Cart] -> [][Inactive_Pad no Cart]
(If Temp still exists, then all Pads are covered, so:)
(Set all Pads to the activated state (Green) )
late [Temp][Inactive_Pad] -> [Temp][Pad_Active]
(Destroy all Gates)
late [Temp][Gate] -> [Temp][] sfx0
(* Otherwise *)
(If an unpressed Pad (Red) is covered by a Cart, that Pad is now pressed.)
late [Pad Cart] -> [Pad_Pressed Cart] sfx1
(If a pressed Pad (Yellow) is not covered by a Cart, that Pad is now unpressed.)
late [Pad_Pressed no Cart] -> [Pad no Cart]
(* Cancel Turn If Player Has Not Moved or Pressed Action *)
late [Player Stay] -> cancel
==============
WINCONDITIONS
==============
All Goal on Player
=======
LEVELS
=======
Message action = wait
##########
#0.C.P.GX#
##########
#######
#I#####
#l###X#
#+-_#.#
#l###G#
#l.C.P#
#######
#########
#+-----_#
#l......#
#l..C...#
#l....#G#
#I..P##X#
#########
#######
#_---_#
###.###
###.###
###.###
#-----#
###C###
###.###
###PGX#
#######
########
#_--.GX#
###.####
#----+##
###.#l##
#...#l##
#.###l##
#----+##
#C######
#.######
#P######
########
########
#+----+#
#l....l#
#l....l#
#+----+#
#......#
#.PC...#
#....###
##00.GX#
########
##########
#+----+###
#l....l###
#l....l###
#+----+-_#
#l..C..###
#I...P.GX#
##########
Message Fin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment