title One player, unlimited rigidbodies
author increpare
homepage www.increpare.com

(

This is a sample of 

- Unlimited rigid bodies
- 1 Player (should be extendable)

It's made as an example for the extended rigid body tutorial here:

https://www.puzzlescript.net/Documentation/rigidbodies.html

)

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

Background
green

Wall
BROWN DARKBROWN
00010
11111
01000
11111
00010

Player
Black Orange White Blue
.000.
.111.
22222
.333.
.3.3.

 Crate
Yellow orange
00000
01110
01110
01110
00000


(The directional overlays bellow establish connections between crates)

 Crate_U
orange
.000.
.....
.....
.....
.....

 Crate_D
orange
.....
.....
.....
.....
.000.

 Crate_L
orange
.....
0....
0....
0....
.....

 Crate_R
orange
.....
....0
....0
....0
.....


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

. = Background
# = Wall
P = Player

w = Crate and Crate_U
x = Crate and Crate_D
a = Crate and Crate_L
d = Crate and Crate_R

e = Crate and Crate_U and Crate_L
z = Crate and Crate_D and Crate_L
q = Crate and Crate_U and Crate_R
c = Crate and Crate_D and Crate_R

r = Crate and Crate_L and Crate_R
t = Crate and Crate_D and Crate_U

1 = Crate and Crate_D and Crate_L and Crate_R
2 = Crate and Crate_U and Crate_L and Crate_R
3 = Crate and Crate_U and Crate_D and Crate_L
4 = Crate and Crate_U and Crate_D and Crate_R

0 = Crate and Crate_U and Crate_D and Crate_L and Crate_R

5 = Crate

 Crate_Connection = Crate_U or Crate_D or Crate_L or Crate_R

Pusher = Player or Crate
Pushable = Crate or Crate_connection

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

 Crate MOVE 36772507

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

Background
Player, Wall, Crate
 Crate_U
 Crate_D
 Crate_L
 Crate_R

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

(For making maps easily: uncomment out the next few lines + press action to discard all boundaries and recreate them)

( [ action player ] [ Crate_connection ] -> [ action player ] [ ] )
( up [ action player ] [ Crate | Crate ] -> [ action player ] [ Crate Crate_u | Crate Crate_d ] )
( right [ action player ] [ Crate | Crate ] -> [ action player ] [ Crate Crate_r | Crate Crate_l ] )

(Propagate movements within and between extended bodies)
[ > Pusher | Pushable ] -> [ > Pusher | > Pushable ]
+ up [ moving Crate Crate_U | Crate ] -> [ moving Crate Crate_U | moving Crate ]
+ down [ moving Crate Crate_D | Crate ] -> [ moving Crate Crate_D | moving Crate ]
+ left [ moving Crate Crate_L | Crate ] -> [ moving Crate Crate_L | moving Crate ]
+ right [ moving Crate Crate_R | Crate ] -> [ moving Crate Crate_R | moving Crate ]

(Move connections along with the crates themselves)
[ moving Crate stationary Crate_connection ] -> [ moving Crate moving Crate_connection ]

(If any crate can't move, cancel the turn. This works because there's only one player.)
[ > Crate | wall ] -> cancel

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

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

###############
#.............#
#..ca...ca.dz.#
#.ce..d1e...w.#
#.t....w......#
#.w.d1a..5.5..#
#....w....5...#
#......dz.....#
#...p...t..dz.#
#..x..cre...w.#
#..w..w...5...#
#.............#
###############