Created
June 28, 2024 20:45
-
-
Save increpare/a055fe14cc07565f21df3d571ef990c6 to your computer and use it in GitHub Desktop.
Simple Block Pushing Game (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 Simple Block Pushing Game | |
author David Skinner | |
homepage www.puzzlescript.net | |
run_rules_on_level_start | |
again_interval 0.05 | |
noaction | |
( debug ) | |
verbose_logging | |
======== | |
OBJECTS | |
======== | |
Background | |
#431408 | |
Wall | |
#190000 #012135 | |
00000 | |
00100 | |
00001 | |
01000 | |
00000 | |
Player | |
#d07d68 #d07d68 #d07d68 #d07d68 | |
.000. | |
.111. | |
22222 | |
.333. | |
.3.3. | |
player_dead | |
black black black black black | |
.000. | |
.111. | |
22222 | |
.333. | |
.3.3. | |
Crate | |
#981111 | |
00000 | |
0...0 | |
0...0 | |
0...0 | |
00000 | |
fluid_1 | |
#692ba9 | |
fluid_2 | |
#157d41 | |
fluid_3 | |
#c5484e | |
fluid_4 | |
#f1892d | |
fluid_5 | |
#e9d963 | |
fluid_6 | |
#cde4fc | |
fluid_7 | |
#000000 | |
flow_up | |
#858585 | |
..... | |
..0.. | |
.0.0. | |
..... | |
..... | |
flow_down | |
#858585 | |
..... | |
..... | |
.0.0. | |
..0.. | |
..... | |
flow_left | |
#858585 | |
..... | |
..0.. | |
.0... | |
..0.. | |
..... | |
flow_right | |
#858585 | |
..... | |
..0.. | |
...0. | |
..0.. | |
..... | |
flow_node | |
orange | |
..... | |
..0.. | |
.000. | |
..0.. | |
..... | |
node_input_n | |
#858585 | |
..0.. | |
..... | |
..... | |
..... | |
..... | |
node_input_s | |
#858585 | |
..... | |
..... | |
..... | |
..... | |
..0.. | |
node_input_e | |
#858585 | |
..... | |
..... | |
....0 | |
..... | |
..... | |
node_input_w | |
#858585 | |
..... | |
..... | |
0.... | |
..... | |
..... | |
fluid_source_u | |
#484848 | |
0...0 | |
0...0 | |
0...0 | |
00.00 | |
00000 | |
fluid_source_d | |
#484848 | |
00000 | |
00.00 | |
0...0 | |
0...0 | |
0...0 | |
fluid_source_l | |
#484848 | |
00000 | |
...00 | |
....0 | |
...00 | |
00000 | |
fluid_source_r | |
#484848 | |
00000 | |
00... | |
0.... | |
00... | |
00000 | |
justremoved | |
red | |
..... | |
..... | |
..... | |
..... | |
0.... | |
incremented | |
yellow | |
....0 | |
..... | |
..... | |
..... | |
..... | |
propagated | |
pink | |
0.... | |
..... | |
..... | |
..... | |
..... | |
t_u | |
lightblue | |
...0. | |
..... | |
..... | |
..... | |
..... | |
t_d | |
lightblue | |
..... | |
..... | |
..... | |
..... | |
.0... | |
t_l | |
lightblue | |
..... | |
0.... | |
..... | |
..... | |
..... | |
t_r | |
lightblue | |
..... | |
..... | |
..... | |
....0 | |
..... | |
head | |
yellow | |
0...0 | |
..... | |
..... | |
..... | |
0...0 | |
======= | |
LEGEND | |
======= | |
. = Background | |
# = Wall | |
P = Player | |
* = crate | |
fluid = fluid_1 or fluid_2 or fluid_3 or fluid_4 or fluid_5 or fluid_6 or fluid_7 | |
flow = flow_up or flow_down or flow_left or flow_right or flow_node | |
fluid_source = fluid_source_u or fluid_source_d or fluid_source_l or fluid_source_r | |
node_input = node_input_n or node_input_s or node_input_e or node_input_w | |
pushable = fluid_source or crate | |
u = fluid_source_u and flow_up | |
d = fluid_source_d and flow_down | |
l = fluid_source_l and flow_left | |
r = fluid_source_r and flow_right | |
obstacle = crate or fluid_source or wall | |
t = t_u or t_d or t_l or t_r | |
======= | |
SOUNDS | |
======= | |
================ | |
COLLISIONLAYERS | |
================ | |
Background | |
fluid | |
flow_up | |
flow_down | |
flow_left | |
flow_right | |
flow_node | |
Player, Wall, pushable, player_dead | |
justremoved | |
node_input_n | |
node_input_s | |
node_input_e | |
node_input_w | |
incremented | |
propagated | |
t_u | |
t_d | |
t_l | |
t_r | |
head | |
====== | |
RULES | |
====== | |
[ ] -> again | |
[ flow_node ] -> [ ] | |
[ fluid ] -> [ ] | |
(PUSHING LOGIC) | |
(0: player pushes objects) | |
[ > Player | fluid_source flow | no obstacle ] -> [ | player | no fluid_source no flow fluid_source flow ] | |
[ > player | crate | no obstacle ] -> [ | player | Crate no flow ] | |
( REDUCTION ) | |
( 4: if a node doesn't have enough sources, replace it with a flow ) | |
( 5: recede flows coming from nowhere ) | |
up [ no flow_up no propagated | flow_up no fluid_source_u ] -> [ | no flow_up propagated ] | |
[ propagated ] -> [ no propagated ] | |
down [ no flow_down no propagated | flow_down no fluid_source_d ] -> [ | no flow_down propagated ] | |
[ propagated ] -> [ no propagated ] | |
left [ no flow_left no propagated | flow_left no fluid_source_l ] -> [ | no flow_left propagated ] | |
[ propagated ] -> [ no propagated ] | |
right [ no flow_right no propagated | flow_right no fluid_source_r ] -> [ | no flow_right propagated ] | |
[ propagated ] -> [ no propagated ] | |
( PROPAGATION ) | |
( 1: propagate flows foward normally ) | |
(force propgation from starters) | |
right [ flow_right | no flow_right no flow_left no obstacle | flow_left ] -> [ flow_right | flow_right flow_left flow_node | flow_left ] | |
down [ flow_down | no flow_down no flow_up no obstacle | flow_up ] -> [ flow_down | flow_down flow_up | flow_up ] | |
(propagate from waves) | |
up [ flow_up no propagated | no flow_up no flow_down no obstacle ] -> [ flow_up | flow_up propagated ] | |
down [ flow_down no propagated | no flow_down no flow_up no obstacle ] -> [ flow_down | flow_down propagated ] | |
left [ flow_left no propagated | no flow_left no flow_right no obstacle ] -> [ flow_left | flow_left propagated ] | |
right [ flow_right no propagated | no flow_right no flow_left no obstacle ] -> [ flow_right | flow_right propagated ] | |
(propagate from nodes) | |
up [ flow_node no propagated | no flow_up no flow_down no obstacle ] -> [ flow_node | flow_up propagated ] | |
down [ flow_node no propagated | no flow_down no flow_up no obstacle ] -> [ flow_node | flow_down propagated ] | |
left [ flow_node no propagated | no flow_left no flow_right no obstacle ] -> [ flow_node | flow_left propagated ] | |
right [ flow_node no propagated | no flow_right no flow_left no obstacle ] -> [ flow_node | flow_right propagated ] | |
(create nodes) | |
[ flow_up flow_down ] -> [ flow_up flow_down flow_node ] | |
[ flow_up flow_left ] -> [ flow_up flow_left flow_node ] | |
[ flow_up flow_right ] -> [ flow_up flow_right flow_node ] | |
[ flow_down flow_left ] -> [ flow_down flow_left flow_node ] | |
[ flow_down flow_right ] -> [ flow_down flow_right flow_node ] | |
[ flow_left flow_right ] -> [ flow_left flow_right flow_node ] | |
up [ fluid_source_u flow_up no propagated | no flow_up no obstacle ] -> [ flow_up fluid_source_u | flow_up propagated ] | |
down [ fluid_source_d flow_down no propagated | no flow_down no obstacle ] -> [ flow_down fluid_source_d | flow_down propagated ] | |
left [ fluid_source_l flow_left no propagated | no flow_left no obstacle ] -> [ flow_left fluid_source_l | flow_left propagated ] | |
right [ fluid_source_r flow_right no propagated | no flow_right no obstacle ] -> [ flow_right fluid_source_r | flow_right propagated ] | |
[ propagated ] -> [ no propagated ] | |
(assign movements to flows) | |
[ flow_up ] -> [ up flow_up ] | |
[ flow_down ] -> [ down flow_down ] | |
[ flow_left] -> [ left flow_left ] | |
[ flow_right ] -> [ right flow_right ] | |
startloop | |
(pick a source, spawn water and a wavefront) | |
random [ fluid_source no propagated ] -> [ fluid_source fluid_1 propagated ] | |
[ > flow fluid | flow no fluid no flow_node no obstacle ] -> [ > flow fluid | flow fluid ] | |
( 3: give nodes colour based on source inputs ) | |
(feed nodes ) | |
+ up [ flow_node no flow_up no t_u no fluid | fluid ] -> [ flow_node fluid t_u | fluid ] | |
+ up [ flow_node no flow_up no t_u fluid_1 | fluid_1 ] -> [ flow_node fluid_2 t_u | fluid_1 ] | |
+ left [ flow_node no flow_left no t_l no fluid | fluid ] -> [ flow_node fluid t_l | fluid ] | |
+ left [ flow_node no flow_left no t_l fluid_1 | fluid_1 ] -> [ flow_node fluid_2 t_l | fluid_1 ] | |
(flow from nodes) | |
+ [ flow_node > flow fluid | no obstacle ] -> [ flow_node > flow fluid | fluid ] | |
+ [ > flow fluid | flow no flow_node no obstacle ] -> [ > flow fluid | flow fluid ] | |
endloop | |
[ t ] -> [ ] | |
[ head ] -> [ ] | |
[ propagated ] -> [ ] | |
(remove movements from flows) | |
[ moving flow ] -> [ stationary flow ] | |
============== | |
WINCONDITIONS | |
============== | |
======= | |
LEVELS | |
======= | |
################## | |
#................# | |
#................# | |
#................# | |
#.....pd...d.....# | |
#................# | |
#................# | |
#...r............# | |
#................# | |
#................# | |
#................# | |
#................# | |
################## | |
########## | |
#....d...# | |
#........# | |
#..r.....# | |
#........# | |
#...p....# | |
#........# | |
########## | |
########## | |
#......d.# | |
#........# | |
#...r....# | |
#........# | |
#...pu...# | |
#........# | |
########## | |
######### | |
#.......# | |
#....d..# | |
#.......# | |
#.......# | |
#..pr...# | |
#.......# | |
######### | |
################## | |
#................# | |
#................# | |
#................# | |
#.....pd...d.....# | |
#................# | |
#................# | |
#...r............# | |
#................# | |
#................# | |
#................# | |
#................# | |
################## | |
################## | |
#................# | |
#..........d.....# | |
#..p.............# | |
#......d.........# | |
#.*...........l..# | |
#................# | |
#...r............# | |
#................# | |
#........u.......# | |
#....u...........# | |
#................# | |
################## | |
################## | |
#.d..............# | |
#...............l# | |
#................# | |
#......d...d.....# | |
#...r............# | |
#................# | |
#...u............# | |
#................# | |
#..p..........u..# | |
#................# | |
#................# | |
################## | |
########## | |
#........# | |
#.......l# | |
#........# | |
#.r......# | |
#p.......# | |
#........# | |
########## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment