title Gobble Rush!
author Mark Richardson
again_interval 0.05
noaction
require_player_movement
run_rules_on_level_start


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

Background
Black

Exit
White Black
01010
10101
01010
10101
01010

Wall
Brown

Hole
Brown
00000
00.00
0...0
0...0
0...0

Player
Pink Blue Brown Red DarkBlue
.222.
.101.
33333
.444.
44.44

Enemy
LightBrown
.....
0..0.
.00..
0000.
0..0.

Alert
Red
....0
....0
.....
....0
.....

Chicken
#EA3 #FC9 #FEA
.....
2....
.110.
01100
.000.

Lettuce
#6C3 #5A2 #482 #361 #240
.2.2.
24342
12421
01310
.002.

LoS
White
.....
.....
.....
.....
.....

MoveU
White
.....
.....
.....
.....
.....

MoveD
White
.....
.....
.....
.....
.....

MoveL
White
.....
.....
.....
.....
.....

MoveR
White
.....
.....
.....
.....
.....

CanMove
White
.....
.....
.....
.....
.....

Level0
White #F00
.....
.....
.111.
.....
.....

Level1
White #F00
00000
.....
.111.
.....
.....

Level2
White #F00
.....
00000
.111.
.....
.....

Level3
White #F88
.....
.....
01110
.....
.....

Level4
White #F00
.....
.....
.111.
00000
.....

Level5
White #F00
.....
.....
.111.
.....
00000


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

. = Background
X = Exit
# = Wall
H = Hole
P = Player
Q = Player and Exit
E = Enemy
F = Enemy and Exit
C = Chicken
D = Chicken and Exit
L = Lettuce
M = Lettuce and Exit
0 = Level0
1 = Level1
2 = Level2
3 = Level3
4 = Level4
5 = Level5

Move = MoveU or MoveD or MoveL or MoveR
Obstacle = Wall or Enemy
Food = Player or Chicken


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

SFX0            97542903 (enemy alerted)
Player  Destroy 41368102 (player eaten)
Chicken Destroy 74663702 (chicken eaten)
Lettuce Destroy 74663702 (lettuce eaten)
Enemy   Create  81259707 (enemy moving)
EndLevel        22595303


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

Background
Exit, Hole, Level0, Level1, Level2, Level3, Level4, Level5
Wall, Player, Enemy, Chicken, Lettuce
LoS, Move
Alert, CanMove


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

(Prevent illegal moves)
[ > Player | Hole ] -> cancel

(Tell alert enemies to move)
[ Enemy Move ] -> [ Enemy CanMove Move ]

(Stop enemies)
late up    [ Enemy CanMove MoveU |    Obstacle no Move ] -> [ Enemy | Obstacle ]
late down  [ Enemy CanMove MoveD |    Obstacle no Move ] -> [ Enemy | Obstacle ]
late left  [ Enemy CanMove MoveL |    Obstacle no Move ] -> [ Enemy | Obstacle ]
late right [ Enemy CanMove MoveR |    Obstacle no Move ] -> [ Enemy | Obstacle ]
late down  [ Enemy CanMove MoveD | Enemy CanMove MoveU ] -> [ Enemy | Enemy    ]
late right [ Enemy CanMove MoveR | Enemy CanMove MoveL ] -> [ Enemy | Enemy    ]
late up    [ Enemy CanMove MoveU | Enemy      no Move  ] -> [ Enemy | Enemy    ]
late down  [ Enemy CanMove MoveD | Enemy      no Move  ] -> [ Enemy | Enemy    ]
late left  [ Enemy CanMove MoveL | Enemy      no Move  ] -> [ Enemy | Enemy    ]
late right [ Enemy CanMove MoveR | Enemy      no Move  ] -> [ Enemy | Enemy    ]

(Move enemies)
late up    [ Enemy CanMove MoveU | no Obstacle         ] -> [       | Enemy MoveU ] again
late down  [ Enemy CanMove MoveD | no Obstacle         ] -> [       | Enemy MoveD ] again
late left  [ Enemy CanMove MoveL | no Obstacle         ] -> [       | Enemy MoveL ] again
late right [ Enemy CanMove MoveR | no Obstacle         ] -> [       | Enemy MoveR ] again
late       [ Enemy CanMove       ]                       -> [ Enemy ]

(Remove alerts)
late       [ Enemy Alert         ]                       -> [ Enemy ]

(Create line of sight)
late [ Food no CanMove ] -> [ Food CanMove ]
late [ Move ] [ CanMove ] -> [ Move ] [ ]

(Chase player)
late [ Player CanMove ] -> [ Player LoS ]
late [ Player LoS | no Wall no LoS ] -> [ Player LoS | LoS ]
late [ Player Los | ... | LoS | no Wall no LoS ] -> [ Player LoS | ... | LoS | LoS ]
late up    [ Enemy LoS no Move | ... | Player LoS ] -> [ Enemy MoveU Alert | ... | Player LoS ] SFX0
late down  [ Enemy LoS no Move | ... | Player LoS ] -> [ Enemy MoveD Alert | ... | Player LoS ] SFX0
late left  [ Enemy LoS no Move | ... | Player LoS ] -> [ Enemy MoveL Alert | ... | Player LoS ] SFX0
late right [ Enemy LoS no Move | ... | Player LoS ] -> [ Enemy MoveR Alert | ... | Player LoS ] SFX0
late [ LoS ] -> [ ]

(Chase chickens)
startloop
late random [ Chicken CanMove ] -> [ Chicken LoS ]
late [ Chicken LoS | no Wall no LoS ] -> [ Chicken LoS | LoS ]
late [ Chicken Los | ... | LoS | no Wall no LoS ] -> [ Chicken LoS | ... | LoS | LoS ]
late up    [ Enemy LoS no Move | ... | Chicken LoS ] -> [ Enemy MoveU Alert | ... | Chicken LoS ] SFX0
late down  [ Enemy LoS no Move | ... | Chicken LoS ] -> [ Enemy MoveD Alert | ... | Chicken LoS ] SFX0
late left  [ Enemy LoS no Move | ... | Chicken LoS ] -> [ Enemy MoveL Alert | ... | Chicken LoS ] SFX0
late right [ Enemy LoS no Move | ... | Chicken LoS ] -> [ Enemy MoveR Alert | ... | Chicken LoS ] SFX0
late [ LoS ] -> [ ]
endloop


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

some Exit on Player
no Alert
no Move


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

..#####....
..#X..#...3
..#...###.0
..#E....#.0
..###...#.0
....#..P#.0
....#####..

..#######..
..#P....#.4
..#.....#.0
..#####.#.0
..#EX...#.0
..###...#.0
....#####..

..#######..
..#.....#.5
..#..#..#.0
..#.....#.0
..#.P##E#.0
..#..#XE#.0
..#######..

..#######..
..#.....#.0
..#.E...#.1
..#.E...#.0
..#.E...#.0
..#XE.P.#.0
..#######..

..#######..
..#..#.X#.0
..#..E..#.2
..##.#E##.0
..#.....#.0
..#P.#..#.0
..#######..

..#######..
..#X...P#.0
..##.#..#.3
..#...#.#.0
..#.....#.0
..#.E#.E#.0
..#######..

..######...
..#P.#.##.0
..#.X..E#.4
..##.#..#.0
..#.....#.0
..##..E.#.0
...######..

...####....
..##..##..0
..#.P..##.5
..#..X.E#.0
..##...##.0
...##E##..0
....###....

..#######..
..#XE...#.0
..#EE..##.0
..#..P..#.1
..#.....#.0
..#.#...#.0
..#######..

..#######..
..#P..#X#.0
..#.....#.0
..##....#.2
..#.....#.0
..#E..#E#.0
..#######..

..#######..
..#X...P#.0
..#.###.#.0
..#.....#.3
..#E###.#.0
..#....C#.0
..#######..

..#######..
..#P....#.0
..#..#.E#.0
..#.....#.4
..##.C.##.0
...##X##..0
....###....

..#######..
..#....C#.0
..##X#.##.0
..#EH..#..5
..##...#..0
...#.PC#..0
...#####...

...######..
...#.#..#.0
..##Q..E#.0
..#...#.#.0
..#..#..#.1
..#.E.C.#.0
..#######..

.....####..
...###.E#.0
...#P...#.0
..##..L.#.0
..#..LXL#.2
..#E..L.#.0
..#######..

...######..
..##LLCX#.0
..#LLCLC#.0
..#LCL.L#.0
..#ELLPL#.3
..#LLC#L#.0
..#######..

..#######..
..#....P#.0
..#E.#E.#.0
..#.....#.0
..##LLL##.4
...##X##..0
....###....

..#######..
..##LXL##.0
..#..L..#.0
..#..#..#.0
..#E...E#.5
..##.P.##.0
..#######..

..#######..
..#H.P..#.0
..#XH...#.0
..#..H.E#.0
..#...H.#.0
..#.E...#.1
..#######..

..#######..
..#.E.E.#.0
..#P....#.0
..#..X.E#.0
..#L..L.#.0
..#.E.EL#.2
..#######..

..#######..
..#L.L.L#.0
..#L.L.L#.0
..#L.P.L#.0
..#L.L.L#.0
..#L.L.L#.3
..##X#X##..
