Created
October 1, 2022 13:05
-
-
Save didmar/e55125e47b76be764865599a5c354052 to your computer and use it in GitHub Desktop.
Snake Corrida (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 Snake Corrida | |
author Didmar | |
homepage www.puzzlescript.net | |
verbose_logging | |
======== | |
OBJECTS | |
======== | |
Background | |
darkgreen grey | |
11111 | |
01111 | |
11101 | |
11111 | |
10111 | |
Wall | |
BROWN DARKBROWN | |
00010 | |
11111 | |
01000 | |
11111 | |
00010 | |
Snake1_head | |
red lightgreen | |
.111. | |
10101 | |
11111 | |
11111 | |
.111. | |
Snake1_u | |
green red | |
00000 | |
00100 | |
01010 | |
00000 | |
00000 | |
Snake1_d | |
green red | |
00000 | |
00000 | |
01010 | |
00100 | |
00000 | |
Snake1_l | |
green red | |
00000 | |
00100 | |
01000 | |
00100 | |
00000 | |
Snake1_r | |
green red | |
00000 | |
00100 | |
00010 | |
00100 | |
00000 | |
Snake1_tail | |
green red | |
00000 | |
00100 | |
01010 | |
00100 | |
00000 | |
Snake2_head | |
lightred lightgreen | |
.111. | |
10101 | |
11111 | |
11111 | |
.111. | |
Snake2_u | |
green lightred | |
00000 | |
00100 | |
01010 | |
00000 | |
00000 | |
Snake2_d | |
green lightred | |
00000 | |
00000 | |
01010 | |
00100 | |
00000 | |
Snake2_l | |
green lightred | |
00000 | |
00100 | |
01000 | |
00100 | |
00000 | |
Snake2_r | |
green lightred | |
00000 | |
00100 | |
00010 | |
00100 | |
00000 | |
Snake2_tail | |
green lightred | |
00000 | |
00100 | |
01010 | |
00100 | |
00000 | |
DeadSnake1 | |
lightgreen | |
..... | |
..... | |
.000. | |
00000 | |
.000. | |
DeadSnake2 | |
lightgreen | |
..... | |
..... | |
.000. | |
00000 | |
.000. | |
Fruit | |
lightred red yellow | |
..11. | |
.202. | |
20002 | |
20002 | |
.222. | |
Player | |
#000000 #212121 #ef9a9a #795548 #1a237e #9e9e9e | |
0000. | |
0121. | |
0222. | |
34443 | |
35553 | |
DeadPlayer | |
#000000 #212121 red #795548 #1a237e #9e9e9e | |
0000. | |
0121. | |
0222. | |
34443 | |
35553 | |
Exit | |
grey black brown | |
01110 | |
12221 | |
12221 | |
12221 | |
12221 | |
GridDown | |
black | |
.0.0. | |
00000 | |
.0.0. | |
00000 | |
.0.0. | |
GridUp | |
black | |
..... | |
..... | |
..... | |
..... | |
..... | |
PlateOff | |
lightred darkgray | |
..... | |
.111. | |
.101. | |
.111. | |
..... | |
PlateOn | |
lightgreen darkgray | |
..... | |
.111. | |
.101. | |
.111. | |
..... | |
(---Path finding stuff---) | |
Path1 | |
#FFAAAA | |
00000 | |
0...0 | |
0...0 | |
0...0 | |
00000 | |
Path2 | |
#55FF55 | |
00000 | |
0...0 | |
0...0 | |
0...0 | |
00000 | |
Path3 | |
#0000FF | |
00000 | |
0...0 | |
0...0 | |
0...0 | |
00000 | |
RightPath | |
Blue | |
..... | |
..... | |
..0.. | |
..... | |
..... | |
Snake1_NextMove | |
red | |
..... | |
.0.0. | |
..... | |
.0.0. | |
..... | |
Snake2_NextMove | |
lightred | |
..... | |
..0.. | |
.0.0. | |
..0.. | |
..... | |
Cursor | |
black | |
..0.. | |
..0.. | |
00000 | |
..0.. | |
..0.. | |
Rock | |
brown | |
.000. | |
00000 | |
00000 | |
00000 | |
.000. | |
======= | |
LEGEND | |
======= | |
. = Background | |
# = Wall | |
E = Exit | |
* = Fruit | |
k = Rock | |
x = GridDown | |
- = PlateOff | |
P = Player | |
1 = Snake1_head | |
u = Snake1_u | |
d = Snake1_d | |
l = Snake1_l | |
r = Snake1_r | |
t = Snake1_tail | |
2 = Snake2_head | |
y = Snake2_u | |
h = Snake2_d | |
g = Snake2_l | |
j = Snake2_r | |
n = Snake2_tail | |
Snake_head = Snake1_head or Snake2_head (Alias for snake heads) | |
Snake = Snake1_head or Snake1_l or Snake1_r or Snake1_d or Snake1_u or Snake1_tail or Snake2_head or Snake2_l or Snake2_r or Snake2_d or Snake2_u or Snake2_tail | |
Snake1 = Snake1_head or Snake1_l or Snake1_r or Snake1_d or Snake1_u or Snake1_tail | |
Snake2 = Snake2_head or Snake2_l or Snake2_r or Snake2_d or Snake2_u or Snake2_tail | |
Path = Path1 or Path2 or Path3 | |
Weight = Snake or Player or Rock or DeadSnake1 or DeadSnake2 | |
======= | |
SOUNDS | |
======= | |
DeadPlayer create 66023704 | |
DeadSnake1 create 78421501 | |
DeadSnake2 create 78421501 | |
Rock move 27381507 (push rock) | |
sfx0 3585306 (plate activated) | |
sfx1 50349106 (plate deactivated) | |
GridUp create 16879905 | |
(GridDown create 16879903) | |
================ | |
COLLISIONLAYERS | |
================ | |
Background | |
DeadSnake1 | |
DeadSnake2 | |
Exit, PlateOff, PlateOn | |
Player, Rock, DeadPlayer, Wall, GridDown, Fruit | |
Snake1_head, Snake1_l, Snake1_r, Snake1_d, Snake1_u, Snake1_tail, Snake2_head, Snake2_l, Snake2_r, Snake2_d, Snake2_u, Snake2_tail | |
Path1, Path2, Path3 | |
RightPath | |
Snake1_NextMove | |
Snake2_NextMove | |
Cursor | |
GridUp | |
====== | |
RULES | |
====== | |
(---Player moves----------------------------------------------------------------------------) | |
(Player can't move on) | |
[ > Player | Wall ] -> [ Player | Wall ] | |
[ > Player | Snake1_head ] -> [ Player | Snake1_head ] | |
[ > Player | Snake1_l ] -> [ Player | Snake1_l ] | |
[ > Player | Snake1_r ] -> [ Player | Snake1_r ] | |
[ > Player | Snake1_u ] -> [ Player | Snake1_u ] | |
[ > Player | Snake1_d ] -> [ Player | Snake1_d ] | |
[ > Player | Snake1_tail ] -> [ Player | Snake1_tail ] | |
[ > Player | Snake2_head ] -> [ Player | Snake2_head ] | |
[ > Player | Snake2_l ] -> [ Player | Snake2_l ] | |
[ > Player | Snake2_r ] -> [ Player | Snake2_r ] | |
[ > Player | Snake2_u ] -> [ Player | Snake2_u ] | |
[ > Player | Snake2_d ] -> [ Player | Snake2_d ] | |
[ > Player | Snake2_tail ] -> [ Player | Snake2_tail ] | |
(Player can push fruits and rocks) | |
[ > Player | Fruit ] -> [ > Player | > Fruit ] | |
[ > Player | Rock | Snake1 ] -> [ > Player | > Rock | DeadSnake1 ] | |
[ > Player | Rock | Snake2 ] -> [ > Player | > Rock | DeadSnake2 ] | |
[ > Player | Rock ] -> [ > Player | > Rock ] | |
(---Snake1 path finding logic---------------------------------------------------------------) | |
[ Player ][ Snake1_head | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path3 ] -> [ Player ][ Snake1_head | Path1 ] | |
startloop | |
[ Player Path1 ] -> [ Player Path1 ] | |
[ Player ][ Path1 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path3 ] -> [ Player ][ Path1 | Path2 ] | |
[ Player Path2 ] -> [ Player Path2 ] | |
[ Player ][ Path2 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path1 ] -> [ Player ][ Path2 | Path3 ] | |
[ Player Path3 ] -> [ Player Path3 ] | |
[ Player ][ Path3 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path2 ] -> [ Player ][ Path3 | Path1 ] | |
endloop | |
( If not found, deleting all pathes ) | |
[ Player ][ no Path ] -> [ Player ][ ] | |
( Tracing back to the player ) | |
[ Player Path ] -> [ Player Path RightPath ] | |
startloop | |
[ Path3 RightPath | Path2 ] -> [ RightPath | Path2 RightPath ] | |
[ Path2 RightPath | Path1 ] -> [ RightPath | Path1 RightPath ] | |
[ Path1 RightPath | Path3 ] -> [ RightPath | Path3 RightPath ] | |
endloop | |
( Cleaning up and starting the movement ) | |
[ Path ] -> [ ] | |
[ Snake1_head | RightPath no GridDown] -> [ Snake1_head | Snake1_NextMove ] | |
[ RightPath ] -> [ ] | |
(---Snake2 path finding logic------------------------------------------------------------) | |
[ Player ][ Snake2_head | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail ] -> [ Player ][ Snake2_head | Path1 ] | |
startloop | |
[ Player Path1 ] -> [ Player Path1 ] | |
[ Player ][ Path1 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path3 ] -> [ Player ][ Path1 | Path2 ] | |
[ Player Path2 ] -> [ Player Path2 ] | |
[ Player ][ Path2 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path1 ] -> [ Player ][ Path2 | Path3 ] | |
[ Player Path3 ] -> [ Player Path3 ] | |
[ Player ][ Path3 | no Wall no Rock no Snake1_head no Snake1_l no Snake1_r no Snake1_u no Snake1_d no Snake1_tail no Snake2_head no Snake2_l no Snake2_r no Snake2_u no Snake2_d no Snake2_tail no Path2 ] -> [ Player ][ Path3 | Path1 ] | |
endloop | |
( If not found, deleting all pathes ) | |
[ Player ][ no Path ] -> [ Player ][ ] | |
( Tracing back to the player ) | |
[ Player Path ] -> [ Player Path RightPath ] | |
startloop | |
[ Path3 RightPath | Path2 ] -> [ RightPath | Path2 RightPath ] | |
[ Path2 RightPath | Path1 ] -> [ RightPath | Path1 RightPath ] | |
[ Path1 RightPath | Path3 ] -> [ RightPath | Path3 RightPath ] | |
endloop | |
( Cleaning up and starting the movement ) | |
[ Path ] -> [ ] | |
[ Snake2_head | RightPath no GridDown] -> [ Snake2_head | Snake2_NextMove ] | |
[ RightPath ] -> [ ] | |
(---Move all snakes-------------------------------------------------------------------------) | |
(Handle collision between snake heads, killing them) | |
[ Snake1_tail ][ Snake1_NextMove Snake2_NextMove ][ Snake2_tail ] -> [ ][ DeadSnake1 DeadSnake2 ][] | |
(Propagate the DeadSnake state to all the snake parts) | |
startloop | |
[ DeadSnake1 ][ Snake1 ] -> [ DeadSnake1 ][ DeadSnake1 ] | |
[ DeadSnake2 ][ Snake2 ] -> [ DeadSnake2 ][ DeadSnake2 ] | |
endloop | |
(movement of Snake1) | |
up [Snake1_head|Snake1_NextMove] -> [Snake1_u Cursor| Snake1_head] | |
down [Snake1_head|Snake1_NextMove] -> [Snake1_d Cursor| Snake1_head] | |
left [Snake1_head|Snake1_NextMove] -> [Snake1_l Cursor| Snake1_head] | |
right [Snake1_head|Snake1_NextMove] -> [Snake1_r Cursor| Snake1_head] | |
startloop | |
up [ Snake1_u | Cursor] -> [ Snake1_u Cursor | no Cursor] | |
down [ Snake1_d | Cursor] -> [ Snake1_d Cursor | no Cursor] | |
left [ Snake1_l | Cursor] -> [ Snake1_l Cursor | no Cursor] | |
right [ Snake1_r | Cursor] -> [ Snake1_r Cursor | no Cursor] | |
[ Snake1_tail | Cursor] -> [ | Snake1_tail no Cursor] | |
endloop | |
(movement of Snake2) | |
up [Snake2_head|Snake2_NextMove] -> [Snake2_u Cursor| Snake2_head] | |
down [Snake2_head|Snake2_NextMove] -> [Snake2_d Cursor| Snake2_head] | |
left [Snake2_head|Snake2_NextMove] -> [Snake2_l Cursor| Snake2_head] | |
right [Snake2_head|Snake2_NextMove] -> [Snake2_r Cursor| Snake2_head] | |
startloop | |
up [ Snake2_u | Cursor] -> [ Snake2_u Cursor | no Cursor] | |
down [ Snake2_d | Cursor] -> [ Snake2_d Cursor | no Cursor] | |
left [ Snake2_l | Cursor] -> [ Snake2_l Cursor | no Cursor] | |
right [ Snake2_r | Cursor] -> [ Snake2_r Cursor | no Cursor] | |
[ Snake2_tail | Cursor] -> [ | Snake2_tail no Cursor] | |
endloop | |
(---Plate logic-----------------------------------------------------------------------------) | |
[PlateOff Player] -> [PlateOn Player] | |
[PlateOff Snake1_head] -> [PlateOn Snake1_head] | |
[PlateOff Snake1_l] -> [PlateOn Snake1_l] | |
[PlateOff Snake1_r] -> [PlateOn Snake1_r] | |
[PlateOff Snake1_d] -> [PlateOn Snake1_d] | |
[PlateOff Snake1_u] -> [PlateOn Snake1_u] | |
[PlateOff Snake1_tail] -> [PlateOn Snake1_tail] | |
[PlateOff Snake2_head] -> [PlateOn Snake2_head] | |
[PlateOff Snake2_l] -> [PlateOn Snake2_l] | |
[PlateOff Snake2_r] -> [PlateOn Snake2_r] | |
[PlateOff Snake2_d] -> [PlateOn Snake2_d] | |
[PlateOff Snake2_u] -> [PlateOn Snake2_u] | |
[PlateOff Snake2_tail] -> [PlateOn Snake2_tail] | |
[PlateOff Rock] -> [PlateOn Rock] | |
(Some weight must staying on the plate to keep it activated) | |
[PlateOn no Weight] -> [PlateOff] sfx1 | |
(If there are 2 plates, both must be activated at the same time) | |
[PlateOn][PlateOff] -> [PlateOff][PlateOff] | |
(Activated plates cause grids to lift up) | |
[PlateOn][GridDown] -> [PlateOn][GridUp] | |
late [PlateOff][GridUp no Weight] -> [PlateOff][GridDown] | |
(---Losing conditions-----------------------------------------------------------------------) | |
late [ Player Snake ] -> [ DeadPlayer ] | |
(---Cleanup---------------------------------------------------------------------------------) | |
[ Snake1_NextMove ] -> [ ] | |
[ Snake2_NextMove ] -> [ ] | |
[ Cursor ] -> [ ] | |
============== | |
WINCONDITIONS | |
============== | |
All Player on Exit | |
no DeadPlayer | |
======= | |
LEVELS | |
======= | |
(Easy) | |
######## | |
#P....E# | |
#.###### | |
#..1llt# | |
######## | |
(Dogging a snake) | |
########## | |
#P..1lltE# | |
#.#......# | |
#........# | |
########## | |
(Dogging snakes #1) | |
########## | |
#.jj2....# | |
#.y..E1..# | |
#Pygn.u..# | |
#...tru..# | |
#........# | |
########## | |
(Dogging snakes #2) | |
########## | |
#....##### | |
#.#.P.1tE# | |
#....##### | |
##.....2n# | |
########## | |
(Snake collision #1) | |
############## | |
######.####### | |
######.####### | |
#trr1.P.2ggnE# | |
######.####### | |
######.####### | |
############## | |
(Snake collision #2) | |
############## | |
#######..2#### | |
#######.#y#### | |
#####...#y#### | |
#####.#P#y#### | |
##......#y#### | |
##.######n#### | |
##...1llltE### | |
############## | |
(Rock #1) | |
########### | |
#P.k1lltE.# | |
########### | |
(Rock #2) | |
############ | |
###.######## | |
#P...1lltE2# | |
#.#k######y# | |
#...####njy# | |
############ | |
(Grids and plates #1) | |
############# | |
#......###### | |
#t1###.-...E# | |
#..x.P.###### | |
############# | |
(Grids and plates #2) | |
########## | |
#.x..xxEx# | |
#.x.-#.x.# | |
#.x....x.# | |
#.xt#.1k.# | |
#.xrrruxP# | |
#.xxxxxx.# | |
#........# | |
########## | |
(Grids and plates #3) | |
########## | |
#........# | |
#..Pk....# | |
#xxxxxx#k# | |
#-.1lltE-# | |
########## | |
(Grids and plates #4) | |
############# | |
#...P.......# | |
#.####x####.# | |
#.#njjj2..#.# | |
#.#.#####.#.# | |
#.#.#####.#.# | |
#.x..-E-..x.# | |
#.#.#####k#.# | |
#.#.#####.#.# | |
#.#.......#.# | |
#.####x####.# | |
#.....1lllt.# | |
############# | |
(Grids and plates #2B) | |
########## | |
########E# | |
#.x..xxxx# | |
#.x.-#.x.# | |
#.x....x.# | |
#.x.#.1k.# | |
#.x..tuxP# | |
#.xxxxxx.# | |
#........# | |
########## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment