(
level ideas
push battery horizontally
have to assemble and then disassemble a circuit, in order to complete it
add a piece to a circut, then break the circuit from another point
level that starts with a closed circuit
level with very dangerous + block
)
title Robot Arm
author Stephen Lavelle
homepage www.increpare.com

run_rules_on_level_start
color_palette c64

run_rules_on_level_start

norepeat_action

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

Background .
darkblue

Player P
Black orange grey Blue
.111.
.111.
22222
13331
.3.3.

R0_Up 0
grey lightgrey
.111.
10001
10001
10001
.111.

R0_Down
grey lightgrey
.111.
10001
10001
10001
.111.

R0_Left
grey lightgrey
.111.
10001
10001
10001
.111.

R0_Right
grey lightgrey
.111.
10001
10001
10001
.111.


R1_Up 1
grey lightgrey
.111.
10001
10001
10001
.111.

R1_Down
grey lightgrey
.111.
10001
10001
10001
.111.

R1_Left
grey lightgrey
.111.
10001
10001
10001
.111.

R1_Right
grey lightgrey
.111.
10001
10001
10001
.111.


R2_Up 2
grey lightgrey
.111.
10001
10001
10001
.111.

R2_Down
grey lightgrey
.111.
10001
10001
10001
.111.

R2_Left
grey lightgrey
.111.
10001
10001
10001
.111.

R2_Right
grey lightgrey
.111.
10001
10001
10001
.111.

R3 3
grey lightgrey
.....
..0..
.010.
..0..
.....

Connector_Up
grey lightgrey
.101.
.111.
.....
.....
.....

Connector_Down
grey lightgrey
.....
.....
.....
.111.
.101.

Connector_Left
grey lightgrey
.....
11...
01...
11...
.....

Connector_Right
grey lightgrey
.....
...11
...10
...11
.....

Moved
transparent

Parent
transparent

GrandParent
transparent

NewRot
transparent

NewRot2
transparent

force
transparent

explosion
red yellow
.101.
10101
01010
10101
.101.

explosionb
red yellow
.101.
10101
01010
10101
.101.

explosion2
yellow red
.101.
10101
01010
10101
.101.

Wall #
darkgrey grey lightgrey
00000
01110
01010
01110
00000

water ,
blue lightblue
00000
00010
00000
00000
01000

Fruit F
Red Green LightRed
..1..
.000.
00020
00000
.000.


FruitPicked G
Red Green LightRed grey grey
..4..
.030.
43334
00300
.040.

DeadFruit
black black black black black
..4..
.030.
43334
00300
.040.

EndPoint E
darkgreen Yellow black green
30003
02220
02220
02220
30003


=======
LEGEND
=======
R0 = R0_up or R0_down or R0_left or R0_right
R1 = R1_up or R1_down or R1_left or R1_right
R2 = R2_up or R2_down or R2_left or R2_right
RobotPiece = R0 or R1 or R2 or R3
* = RobotPiece or Player
connector = connector_up or connector_down or connector_left or connector_right

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

sfx0 43004308 (explosion)
sfx1 69392707
sfx2 57370907 (push machine)
sfx3 62083508 (rotate machine)
sfx4 90419908 (grab)
sfx5 50782902 (drop in hole)
sfx6 76878101 (empty grab)
sfx7 13941101 (dead fruit)
sfx8 42541302 (release)
Player move 88476108
startgame 30513908
endlevel 5524308
endgame 5524308
showmessage 41852908
closemessage 41852908

================
COLLISIONLAYERS
================
Background
water
EndPoint
Player
Moved
Fruit
FRUITPICKED
deadfruit
R0_up, R0_down, R0_left, R0_right
R1_up, R1_down, R1_left, R1_right
R2_up, R2_down, R2_left, R2_right
connector_up
connector_down
connector_left
connector_right
R3
parent
GrandParent
newrot
newrot2
force
wall
explosion, explosion2, explosionb

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

[ connector ] -> [ ]

[ > player | fruit ] -> cancel

[ > player | water ] -> cancel

[ > player | ] -> [ > player | > force ]

[ > player | robotpiece | wall ] -> cancel

(place movement arrows)
up [ R0_Up | ] -> [ up R0_Up | up Parent ]
up [ R1_Up | ] -> [ up R1_Up | up Parent ]
up [ R2_Up | ] -> [ up R2_Up | up Parent ]

down [ R0_down | ] -> [ down R0_down | down Parent ]
down [ R1_down | ] -> [ down R1_down | down Parent ]
down [ R2_down | ] -> [ down R2_down | down Parent ]

left [ R0_left | ] -> [ left R0_left | left Parent ]
left [ R1_left | ] -> [ left R1_left | left Parent ]
left [ R2_left | ] -> [ left R2_left | left Parent ]

right [ R0_right | ] -> [ right R0_right | right Parent ]
right [ R1_right | ] -> [ right R1_right | right Parent ]
right [ R2_right | ] -> [ right R2_right | right Parent ]


( force propagation like this isn't very nice )
( [ > force < parent | ] -> [ < parent | > force ] )

[ R3 > force < parent ] [ > R0 ] [ v R1 ] [ R2 ] -> [ R3 < parent ] [ > R0 ] [ v R1 ] [ r2 > force ]
[ R3 > force < parent ] [ > R0 ] [ ^ R1 ] [ R2 ] -> [ R3 < parent ] [ > R0 ] [ ^ R1 ] [ r2 > force ]

[ > force < parent no R0] [R0]-> [ < parent ] [ > force R0 ]
[ > force R3 perpendicular parent ] [ R2 < parent ] [ R0 ] -> [ R3 perpendicular parent ] [ R2 < parent ] [ > force R0 ]

[ > force R2 perpendicular parent ] [ R1 < parent ] [ R0 ] -> [ R2 perpendicular parent ] [ R1 < parent ] [ > force R0 ]


[ > force moving R0 | ] -> [ | moving R0] sfx2

[ > force moving R1 perpendicular parent ] [ R0 ] -> [ moving R1 perpendicular parent ] [ > R0 ] sfx3
[ > force moving R2 perpendicular parent ] [ R1 ] -> [ moving R2 perpendicular parent ] [ > R1 ] sfx3
[ > force 		R3 perpendicular parent ] [ R2 ] -> [ R3 perpendicular parent ] [ > R2 ] sfx3


(rebuild arm)

(add new parents)

[ > R1 ] [ R2 ] -> [ > R1 ] [ R2 > NewRot ]
[ > R0 ] [ R1 ] [ R2 ] -> [ > R0 ] [ R1 > NewRot ] [ R2 > NewRot2 ]

[ > Parent R1 ] [ R2 ] -> [ > Parent R1 ] [ > GrandParent R2 ]

[ ^ Parent > NewRot > RobotPiece ] -> [ V RobotPiece ]
[ ^ Parent > NewRot v RobotPiece ] -> [ < RobotPiece ]
[ ^ Parent > NewRot < RobotPiece ] -> [ ^ RobotPiece ]
[ ^ Parent > NewRot ^ RobotPiece ] -> [ > RobotPiece ]

[ ^ Parent < NewRot > RobotPiece ] -> [ ^ RobotPiece ]
[ ^ Parent < NewRot v RobotPiece ] -> [ > RobotPiece ]
[ ^ Parent < NewRot < RobotPiece ] -> [ V RobotPiece ]
[ ^ Parent < NewRot ^ RobotPiece ] -> [ < RobotPiece ]


[ ^ GrandParent > NewRot2 > R2 ] -> [ V R2 ]
[ ^ GrandParent > NewRot2 v R2 ] -> [ < R2 ]
[ ^ GrandParent > NewRot2 < R2 ] -> [ ^ R2 ]
[ ^ GrandParent > NewRot2 ^ R2 ] -> [ > R2 ]

[ ^ GrandParent < NewRot2 > R2 ] -> [ ^ R2 ]
[ ^ GrandParent < NewRot2 v R2 ] -> [ > R2 ]
[ ^ GrandParent < NewRot2 < R2 ] -> [ V R2 ]
[ ^ GrandParent < NewRot2 ^ R2 ] -> [ < R2 ]

[ NewRot ] -> [ ]
[ NewRot2 ] -> [ ]
[ Parent ] -> [ ]
[ GrandParent ] -> [ ]


(change sprites)
[ up R0 ] -> [ up R0_Up ]
[ up R1 ] -> [ up R1_Up ]
[ up R2 ] -> [ up R2_Up ]

[ down R0 ] -> [ down R0_down ]
[ down R1 ] -> [ down R1_down ]
[ down R2 ] -> [ down R2_down ]

[ left R0 ] -> [ left R0_left ]
[ left R1 ] -> [ left R1_left ]
[ left R2 ] -> [ left R2_left ]

[ right R0 ] -> [ right R0_Right ]
[ right R1 ] -> [ right R1_Right ]
[ right R2 ] -> [ right R2_Right ]

(work from the base up when placing)
up [ up R0 | no R1 ] [ moving R1 ] -> [ up R0 | moving R1 ] [ ]
down [ down R0 | no R1 ] [ moving R1 ] -> [ down R0 | moving R1 ] [ ]
left [ left R0 | no R1 ] [ moving R1 ] -> [ left R0 | moving R1 ] [ ]
right [ right R0 | no R1 ] [ moving R1 ] -> [ right R0 | moving R1 ] [ ]

up [ up R1 | no R2 ] [ moving R2 ] -> [ up R1 | moving R2 ] [ ]
down [ down R1 | no R2 ] [ moving R2 ] -> [ down R1 | moving R2 ] [ ]
left [ left R1 | no R2 ] [ moving R2 ] -> [ left R1 | moving R2 ] [ ]
right [ right R1 | no R2 ] [ moving R2 ] -> [ right R1 | moving R2 ] [ ]


up [ up R2 | no R3 ] [ R3 ] -> [ up R2 | R3 ] [ ]
down [ down R2 | no R3 ] [ R3 ] -> [ down R2 | R3 ] [ ]
left [ left R2 | no R3 ] [ R3 ] -> [ left R2 | R3 ] [ ]
right [ right R2 | no R3 ] [ R3 ] -> [ right R2 | R3 ] [ ]




up [ up R2 | no R3 ] [ R3 ] -> [ R2_up | R3 ] [ ]
down [ down R2 | no R3 ] [ R3 ] -> [ R2_down | R3 ] [ ]
left [ left R2 | no R3 ] [ R3 ] -> [ R2_left | R3 ] [ ]
right [ right R2 | no R3 ] [ R3 ] -> [ R2_right | R3 ] [ ]


[ > RobotPiece no moved ] -> [ RobotPiece ]


up [ R0_Up | ] -> [ R0_Up connector_up | connector_down ]
up [ R1_Up | ] -> [ R1_Up connector_up | connector_down ]
up [ R2_Up | ] -> [ R2_Up connector_up | connector_down ]

down [ R0_down | ] -> [ R0_down connector_down | connector_up ]
down [ R1_down | ] -> [ R1_down connector_down | connector_up ]
down [ R2_down | ] -> [ R2_down connector_down | connector_up ]

left [ R0_left | ] -> [ R0_left connector_left | connector_right ]
left [ R1_left | ] -> [ R1_left connector_left | connector_right ]
left [ R2_left | ] -> [ R2_left connector_left | connector_right ]

right [ R0_right | ] -> [ R0_right connector_right | connector_left ]
right [ R1_right | ] -> [ R1_right connector_right | connector_left ]
right [ R2_right | ] -> [ R2_right connector_right | connector_left ]

[RobotPiece Wall no explosion no explosion2 ] -> [ RobotPiece Wall explosion ] sfx0

[ R0 R2 no explosion no explosion2] -> [ R0 R2 explosion ] sfx0
[ R0 R3 no explosion no explosion2 ] -> [ R0 r3 explosion ] sfx0
[ R1 R3 no explosion no explosion2 ] -> [ R1 R3 explosion ] sfx0

[ explosion2 ] -> [ explosionb ] again
[ explosion ] -> [ explosion2] again
[ explosionb ] -> [explosion] again

[ > player  | wall ] -> cancel

[FruitPicked ] [ R3 no FruitPicked ] -> [ ] [ R3 FruitPicked ]

[ action player ] [ R3 Fruit no fruitpicked ] -> [ player ] [ R3 Fruitpicked] sfx4
[ action player ] [ R3 fruitpicked no fruit ] -> [ player ] [ r3 fruit ] sfx8

[action player ] [ r3 no fruit no fruitpicked ] -> sfx6


[ fruit endpoint ] -> [endpoint] sfx5
[ fruit water ] -> [ deadfruit water ] sfx7
late [R0 water ] -> cancel
[R0 fruit ] -> cancel

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

no fruit
no fruitpicked
no deadfruit

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

message press x to grip and ungrip the mechanical arm
message put fruit in hole

message Level 1 of 3

###################
###################
###################
###..,........,.###
###..,...3....,.###
###..,...2....,.###
###.F,.E.1.,,,F,###
###..,...0....,.###
###..,..P.....,.###
###..,........,.###
###################
###################
###################

message Level 2 of 3

##############
##############
##############
###..3.....###
###..2.....###
###..1.,,,,###
###.E0.,...###
###....,FF.###
###.P..,...###
##############
##############
##############

message Level 3 of 3

###################
###################
###################
########........###
###..3.#...##.f.###
###..2..........###
###..1...#....#.###
###.e0..........###
###..p..#...#.f.###
#########.......###
###################
###################
###################

message congratulations
