title Rigid Body example
author Anonymous
homepage www.puzzlescript.net

verbose_logging

(

Example for
https://www.puzzlescript.net/Documentation/rigidbodies.html#many_many

)

========
OBJECTS
========

Background 
white  

Target 
DarkBlue    

Wall 
DarkGrey

Player
Blue
..0..
..0.0
00000
.000.
.0.0.

Shadow
Black
..0..
0.0..
00000
.000.
.0.0.

( three multi-cells blocks )
Crate 
orange

Chest
green

Box
red

( 1-cell small block )
Small
darkred
.....
.000.
.000.
.000.
.....

( sticky, multicellular block when in contact )
Glue
pink
.000.
00000
00000
00000
.000.

( a flag to know what is allowed move )
Wanna_Move
#ff00ff
.....
.....
..0..
.....
.....

=======
LEGEND
=======

. = Background
# = Wall
P = Player
S = Shadow
* = Crate
+ = Box
% = Chest
o = Small
g = Glue

( blocks that can be moved by the player )
Movable = Crate or Box or Chest or Small or Glue

( all things that can move and push blocks )
Mover = Player or Shadow or Movable 

( things that can stop a movement if they are stationary )
Obstacle = Wall or Mover

=======
SOUNDS
=======

================
COLLISIONLAYERS
================

Background
Target
Obstacle
Wanna_Move

======
RULES     
======     

[ > player ] [ stationary shadow ] -> [ > player ] [ < shadow ]

( 1. Propagate movements forward )
[ > Mover | stationary Movable ] -> [ > Mover | > Movable  ]
+ [ > Box    ] [ stationary Box   ] -> [ > Box    ] [ > Box    ]
+ [ > Crate  ] [ stationary Crate ] -> [ > Crate  ] [ > Crate  ]
+ [ > Chest  ] [ stationary Chest ] -> [ > Chest  ] [ > Chest  ]
+ [ moving Glue | stationary Glue ] -> [ moving Glue | moving Glue ]

( 2. Propagate obstructions backwards )
[ > Mover  | stationary Obstacle ] -> [ stationary Mover | Obstacle ]

	(the next lines deal with directional conflicts)
+ [ ^ Crate | < Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ ^ Crate | > Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ ^ Crate | v Crate ] -> [ stationary Crate | stationary Crate ] 

+ [ v Crate | < Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ v Crate | > Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ v Crate | ^ Crate ] -> [ stationary Crate | stationary Crate ] 

+ [ < Crate | > Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ < Crate | ^ Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ < Crate | v Crate ] -> [ stationary Crate | stationary Crate ] 

+ [ > Crate | < Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ > Crate | ^ Crate ] -> [ stationary Crate | stationary Crate ] 
+ [ > Crate | v Crate ] -> [ stationary Crate | stationary Crate ] 

(also one space removed)
+ [ > Mover | |  < Mover ] -> [ stationary Mover | |  < Mover ] 

+ [ > Crate  ] [ stationary Crate ] -> [ stationary Crate ] [ Crate ]
+ [ > Box    ] [ stationary Box   ] -> [ stationary Box   ] [ Box   ]
+ [ > Chest  ] [ stationary Chest ] -> [ stationary Chest ] [ Chest ]
+ [ moving Glue | stationary Glue ] -> [ stationary Glue | Glue ]

( 3. remove all movement, keep a flag )
[ > Movable ] -> [ Movable wanna_move ]

( 4. propagate movement only on wanna_move things )
(    ie redo step 1 but with WANNA_MOVE added to the first line below )
[ > Mover  | stationary Movable WANNA_MOVE ] -> [ > Mover | > Movable ]
+ [ > Box   ] [ stationary Box   ] -> [ > Box   ] [ > Box   ]
+ [ > Crate ] [ stationary Crate ] -> [ > Crate ] [ > Crate ]
+ [ > Chest ] [ stationary Chest ] -> [ > Chest ] [ > Chest ]
+ [ moving Glue | stationary Glue ] -> [ moving Glue | moving Glue ]

( 5. cleanup, remove flag )
[ wanna_move ] -> [ ]


==============
WINCONDITIONS
==============

=======     
LEVELS
=======

#########
#.......#
#..p....#
#.......#
#.......#
#..***..#
#.......#
#....S..#
#.......#
#########

