Created
July 16, 2018 21:22
-
-
Save jamesamiles/07e771f299d7e02cde990c244af4738c to your computer and use it in GitHub Desktop.
Smart Movement Demo (PuzzleScript Script)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Play this game by pasting the script in http://www.puzzlescript.net/editor.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title Smart Movement Demo | |
======== | |
OBJECTS | |
======== | |
Background | |
Green LIGHTGREEN | |
00000 | |
01000 | |
00000 | |
00010 | |
00000 | |
Exit | |
Brown LIGHTBROWN Yellow | |
00000 | |
01110 | |
01110 | |
01120 | |
01110 | |
Player | |
Black | |
.000. | |
.000. | |
00000 | |
.000. | |
.0.0. | |
Block | |
Brown LIGHTBROWN | |
00000 | |
01110 | |
01110 | |
01110 | |
00000 | |
Wall | |
Gray DARKGRAY | |
00000 | |
11000 | |
00000 | |
00011 | |
00000 | |
(Status) | |
Check_Next | |
TRANSPARENT | |
Can_Move | |
TRANSPARENT | |
Cannot_Move | |
TRANSPARENT | |
Waiting | |
TRANSPARENT | |
======= | |
LEGEND | |
======= | |
# = Wall | |
B = Block | |
P = Player | |
X = Exit | |
. = Background | |
object = Wall or Block or Player | |
status = Check_Next or Can_Move or Cannot_Move or Waiting | |
======= | |
SOUNDS | |
======= | |
================ | |
COLLISIONLAYERS | |
================ | |
Background | |
status | |
Exit | |
object | |
====== | |
RULES | |
====== | |
[status] -> [] | |
(* Walls are immobile, empty spaces are no obstacle. *) | |
[Wall] -> [Wall Cannot_Move] | |
[no object] -> [no object Can_Move] | |
StartLoop | |
(* The first time through, an object checks to see whether it is blocked, unblocked, or ambiguous. *) | |
[> object no status | Can_Move] -> [> object Can_Move| Can_Move] | |
[> object no status | Cannot_Move] -> [object Cannot_Move | Cannot_Move] | |
[> object no status | Waiting] -> [> object Waiting | Waiting] | |
(* If there is something in the way, the momentum is transfered forward, and the object waits to figure out if the path ahead is blocked or clear. *) | |
[> object no status | object no status] -> [> object Waiting| > object Check_Next] (* This may change depending on mechanic *) | |
(* An object that is waiting checks to see if the block ahead of it has been decided yet. *) | |
[> object Waiting | Can_Move] -> [> object Can_Move| Can_Move] | |
[> object Waiting | Cannot_Move] -> [object Cannot_Move | Cannot_Move] | |
(* An object that can definitely move will transfer movement to its neighbors *) | |
[moving object Can_Move | object no status] -> [moving object Can_Move | moving object Check_Next] (* Your Mechanic Goes Here *) | |
[Check_Next] -> [] | |
EndLoop | |
============== | |
WINCONDITIONS | |
============== | |
Some Exit on Player | |
======= | |
LEVELS | |
======= | |
########## | |
#........# | |
#...B....# | |
#...B.#..# | |
#.P.B....# | |
#.......X# | |
########## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment