title Unconventional Guns
author rectangular Tim

(run_rules_on_level_start)
background_color darkblue
again_interval 0.07
key_repeat_interval 0.15
(verbose_logging)

homepage http://ludumdare.com/compo/ludum-dare-32/?action=preview&uid=39396

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

Background
lightGray

Gun
Black
.....
.....
.000.
.0...
.....

PlayerU
Blue LightRed Brown White
.222.
.222.
10001
.000.
.2.2.

PlayerD
Blue LightRed Brown White
.222.
.313.
10001
.000.
.2.2.

PlayerL
Blue LightRed Brown White
.222.
.312.
.010.
.000.
..22.

PlayerR
Blue LightRed Brown White
.222.
.213.
.010.
.000.
.22..

ZombiePlayerU
Blue Green Brown Red
.222.
.222.
10001
.000.
.2.2.

ZombiePlayerD
Blue Green Brown Red
.222.
.313.
10001
.000.
.2.2.

ZombiePlayerL
Blue Green Brown Red
.222.
.312.
.010.
.000.
..22.

ZombiePlayerR
Blue Green Brown Red
.222.
.213.
.010.
.000.
.22..

ZombieAsleep
DarkRed Green Black Red
.222.
.111.
10001
.000.
.2.2.

ZombieAwake
DarkRed Green Black Red
.222.
.313.
10001
.000.
.2.2.

Werewolf
Brown Black
.000.
.101.
00000
.000.
.0.0.

SnakeHeadU
LightGreen Green White
.000.
12021
11011
11011
.101.

SnakeHeadD
LightGreen Green White Black
.101.
12021
10001
13331
.111.

SnakeHeadL
LightGreen Green White
000..
.1200
..111
.1111
111..

SnakeHeadR
LightGreen Green White
..000
0021.
111..
1111.
..111

SnakeU
LightGreen Green
.101.
.101.
.....
.....
.....

SnakeD
LightGreen Green
.....
.....
.101.
.101.
.101.

SnakeL
LightGreen Green
.....
000..
111..
111..
.....

SnakeR
LightGreen Green
.....
..000
..111
..111
.....

Water
Blue lightBlue
10000
00000
00010
00000
00100

FloodingR
Blue lightBlue
100..
000..
000..
000..
001..

FloodingL
Blue lightBlue
..000
..000
..010
..000
..100

FloodingU
Blue lightBlue
.....
.....
00010
00000
00100

FloodingD
Blue lightBlue
10000
00000
00010
.....
.....

WaterDrown0
Blue #000033 lightBlue
21110
01110
11111
01110
01210

WaterDrown1
Blue #000066 lightBlue
21110
01110
11111
01110
01210

WaterSinking0
#000044 lightBlue
10000
00000
00010
00000
00100

WaterSinking1
#000088 lightBlue
10000
00000
00010
00000
00100

WaterSinking2
Blue lightBlue #000088
10000
02220
02210
02220
00100

WaterSinking3
Blue lightBlue #0000BB
10000
02220
02210
02220
00100

WaterSinking4
Blue  lightBlue #0000BB
10000
00000
00210
00000
00100

Crate
Brown Orange LightBrown
12221
20002
20002
20002
12221

Wall
darkblue

WallL
Black
0....
0....
0....
0....
0....

WallR
Black
....0
....0
....0
....0
....0

WallU
Black
00000
.....
.....
.....
.....

WallD
Black
.....
.....
.....
.....
00000

Digit0
White
..00.
.0..0
.0..0
.0..0
..00.

Digit1
White
...0.
..00.
...0.
...0.
..000

Digit2
White
..00.
.0..0
...0.
..0..
.0000

Digit3
White
.000.
....0
..00.
....0
.000.

Digit4
White
...0.
..0..
.0.0.
.0000
...0.

Digit5
White
.0000
.0...
.000.
....0
.000.

Digit6
White
..00.
.0...
.000.
.0..0
..00.

Digit7
White
.0000
....0
...0.
..0..
.0...

Digit8
White
..00.
.0..0
..00.
.0..0
..00.

Digit9
White
..00.
.0..0
..000
....0
..00.

previousHead
transparent

previousCollision
transparent

Collider
transparent

GoU
transparent

GoD
transparent

GoL
transparent

GoR
transparent

Vision
transparent

LoLevelTarget
transparent

HiLevelTarget
transparent

SnakeGun
transparent

WaterGun
transparent

canMove
transparent

recoil
transparent

previousPosition
transparent

Winning
transparent

Cover
darkblue

q
Black
0....
0....
.0...
..0..
...00

i
Black
00...
..0..
...0.
....0
....0

e
Black
00000
.....
.....
.....
.....

r
Black
0....
0....
0....
0....
0....

t
Black
...00
.00..
.0...
0....
0....

y
Black
....0
....0
...0.
..00.
00...

x
Gray
0...0
.0.0.
..0..
.0.0.
0...0

u
Gray
.....
..0..
.000.
0.0.0
..0..

l
Gray
...0.
..0..
.0000
..0..
...0.

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

WallOutline = WallU or WallD or WallL or WallR

AnyDigit = Digit0 or Digit1 or Digit2 or Digit3 or Digit4 or Digit5 or Digit6 or Digit7 or Digit8 or Digit9

Player = PlayerU or PlayerD or PlayerL or PlayerR
ZombiePlayer = ZombiePlayerU or ZombiePlayerD or ZombiePlayerL or ZombiePlayerR
AnyPlayer = Player or ZombiePlayer
Zombie = ZombieAwake or ZombieAsleep or ZombiePlayer
Monster = Zombie or Werewolf

SnakeHead = SnakeHeadU or SnakeHeadD or SnakeHeadL or SnakeHeadR
SnakeBody = SnakeU or SnakeD or SnakeL or SnakeR
Snake = SnakeHead or SnakeBody

SnakeFood = AnyPlayer or Zombie or Werewolf
WerewolfFood = AnyPlayer or Zombie

WaterBlocker = Snake or Wall
Drownable = Player or Werewolf
Sinking = WaterDrown0 or WaterDrown1 or WaterSinking0 or WaterSinking1 or WaterSinking2 or WaterSinking3 or WaterSinking4
Flooding = FloodingU or FloodingD or FloodingL or FloodingR
AnyWater = Water or Sinking

Animation = Flooding or Sinking

NoSnakeBody = AnyPlayer or Zombie or Werewolf or Crate or Wall or SnakeHead
Obstacle    = AnyPlayer or Zombie or Werewolf or Crate or Wall or SnakeHead or Collider
Direction = GoU or GoD or GoL or GoR

Pushable = Crate or Zombie
Pusher = Player or SnakeHead or Pushable

Lines = q or i or e or r or t or y
Decoration = Gun or Lines or x or u or l

Target = LoLevelTarget or HiLevelTarget

. = Background
# = Wall
~ = Water
p = PlayerD and canMove
s = PlayerD and SnakeGun and canMove
o = PlayerD and WaterGun and canMove
z = ZombieAsleep
w = Werewolf
g = Gun
c = Crate
" = PlayerD and Cover

0 = Wall and Digit0
1 = Wall and Digit1
2 = Wall and Digit2
3 = Wall and Digit3
4 = Wall and Digit4
5 = Wall and Digit5
6 = Wall and Digit6
7 = Wall and Digit7
8 = Wall and Digit8
9 = Wall and Digit9

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

Player Move 23783707
Player Create 23783707
Werewolf Move 23783707
sfx1 84569108 (death)
sfx2 27012908 (snake shot)
sfx3 17311702 (collide)
sfx4 55941902 (eat)
sfx5 59606702 (bat)
sfx6 52112502 (impossible)
sfx7 89706502 (crowbar)
sfx8 1782108  (water shot)
sfx9 59937708 (drown)

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

Background
AnyWater Flooding
SnakeU Decoration
SnakeL Direction
SnakeR
Obstacle
SnakeD
WallL Vision Target
WallR SnakeGun WaterGun
WallU previousCollision previousPosition
WallD recoil
AnyDigit canMove previousHead Cover
Winning

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

(Editing convenience: Automatically add outlines to walls)
([ WallOutline ] -> [ ]
up   [ Wall | No Wall ] -> [ Wall WallU | ]
down [ Wall | No Wall ] -> [ Wall WallD | ]
left [ Wall | No Wall ] -> [ Wall WallL | ]
right[ Wall | No Wall ] -> [ Wall WallR | ])

(player faces a certain direction)
[ up    Player no PlayerU ] [ canMove ] -> [ PlayerU ] [ canMove ]
[ down  Player no PlayerD ] [ canMove ] -> [ PlayerD ] [ canMove ]
[ left  Player no PlayerL ] [ canMove ] -> [ PlayerL ] [ canMove ]
[ right Player no PlayerR ] [ canMove ] -> [ PlayerR ] [ canMove ]

(shoot the Snake Gun)
up    [ action PlayerU | no Wall no Crate ] [ canMove SnakeGun ] -> [ PlayerU recoil | SnakeHeadU ] [ SnakeGun ] sfx2
down  [ action PlayerD | no Wall no Crate ] [ canMove SnakeGun ] -> [ PlayerD recoil | SnakeHeadD ] [ SnakeGun ] sfx2
left  [ action PlayerL | no Wall no Crate ] [ canMove SnakeGun ] -> [ PlayerL recoil | SnakeHeadL ] [ SnakeGun ] sfx2
right [ action PlayerR | no Wall no Crate ] [ canMove SnakeGun ] -> [ PlayerR recoil | SnakeHeadR ] [ SnakeGun ] sfx2
[ action Player ] [ canMove SnakeGun ] -> [ Player ] [ canMove SnakeGun ] sfx6
(choose snake direction, when it can't move anymore)
[ moving Player ] [ SnakeHead previousHead ] -> [ stationary Player ] [ moving SnakeHead previousHead ]
(snake head moves forwards)
up    [ stationary SnakeHeadU ] -> [ > SnakeHeadU ]
down  [ stationary SnakeHeadD ] -> [ > SnakeHeadD ]
left  [ stationary SnakeHeadL ] -> [ > SnakeHeadL ]
right [ stationary SnakeHeadR ] -> [ > SnakeHeadR ]
(BONK!)
late [ SnakeHead previousHead no previousCollision ] -> [ SnakeHead previousHead previousCollision] sfx3
late [ SnakeHead no previousHead ] [ previousCollision ] -> [ SnakeHead no previousHead ] [ ]
(snakes eat things)
up    [ > SnakeHead | SnakeFood ] -> [ > SnakeHead | no SnakeBody ] sfx4
down  [ > SnakeHead | SnakeFood ] -> [ > SnakeHead | no SnakeBody ] sfx4
left  [ > SnakeHead | SnakeFood ] -> [ > SnakeHead | no SnakeBody ] sfx4
right [ > SnakeHead | SnakeFood ] -> [ > SnakeHead | no SnakeBody ] sfx4
(remember previous position of snake head)
[ previousHead ] -> [ ]
[ SnakeHead ] -> [ SnakeHead previousHead ]
(set the snake head orientation)
late up    [ previousHead | SnakeHead ] -> [ previousHead | SnakeHeadU ]
late down  [ previousHead | SnakeHead ] -> [ previousHead | SnakeHeadD ]
late left  [ previousHead | SnakeHead ] -> [ previousHead | SnakeHeadL ]
late right [ previousHead | SnakeHead ] -> [ previousHead | SnakeHeadR ]
(create the snake body)
up    [ PlayerU no SnakeU ] [ Snake ] [ SnakeGun ] -> [ PlayerU SnakeU ] [ Snake ] [ SnakeGun ]
down  [ PlayerD no SnakeD ] [ Snake ] [ SnakeGun ] -> [ PlayerD SnakeD ] [ Snake ] [ SnakeGun ]
left  [ PlayerL no SnakeL ] [ Snake ] [ SnakeGun ] -> [ PlayerL SnakeL ] [ Snake ] [ SnakeGun ]
right [ PlayerR no SnakeR ] [ Snake ] [ SnakeGun ] -> [ PlayerR SnakeR ] [ Snake ] [ SnakeGun ]
late up    [ no SnakeU no AnyPlayer | SnakeHeadU ] -> [ SnakeU | SnakeHeadU ]
late down  [ no SnakeD no AnyPlayer | SnakeHeadD ] -> [ SnakeD | SnakeHeadD ]
late left  [ no SnakeL no AnyPlayer | SnakeHeadL ] -> [ SnakeL | SnakeHeadL ]
late right [ no SnakeR no AnyPlayer | SnakeHeadR ] -> [ SnakeR | SnakeHeadR ]
(connect the snake body)
late up    [ SnakeU | no SnakeD no NoSnakeBody ] -> [ SnakeU | SnakeD ]
late down  [ SnakeD | no SnakeU no NoSnakeBody ] -> [ SnakeD | SnakeU ]
late left  [ SnakeL | no SnakeR no NoSnakeBody ] -> [ SnakeL | SnakeR ]
late right [ SnakeR | no SnakeL no NoSnakeBody ] -> [ SnakeR | SnakeL ]
(make the snake body impassable)
late [ SnakeBody no Obstacle ] -> [ SnakeBody Collider ]

(recoil)
[ previousPosition ] -> [ ]
[ Player ] -> [ Player previousPosition ]
up    [ stationary PlayerU ] [ recoil ] -> [ < PlayerU ] [ recoil ]
down  [ stationary PlayerD ] [ recoil ] -> [ < PlayerD ] [ recoil ]
left  [ stationary PlayerL ] [ recoil ] -> [ < PlayerL ] [ recoil ]
right [ stationary PlayerR ] [ recoil ] -> [ < PlayerR ] [ recoil ]
late [ Player previousPosition ] [ recoil ] -> [ Player previousPosition ] [ ]

(flooding animation)
[ Flooding ] -> [ Water ]
(shoot the water gun)
[ action Player ] [ canMove WaterGun ] -> [ action Player ] [ WaterGun ]
up    [ action PlayerU | no Water ] [ WaterGun ] -> [ PlayerU |   FloodingU ] [ WaterGun ] sfx8
down  [ action PlayerD | no Water ] [ WaterGun ] -> [ PlayerD |   FloodingD ] [ WaterGun ] sfx8
left  [ action PlayerL | no Water ] [ WaterGun ] -> [ PlayerL |   FloodingL ] [ WaterGun ] sfx8
right [ action PlayerR | no Water ] [ WaterGun ] -> [ PlayerR |   FloodingR ] [ WaterGun ] sfx8
up    [ action PlayerU |    Water ] [ WaterGun ] -> [ PlayerU | > FloodingU ] [ WaterGun ] sfx8
down  [ action PlayerD |    Water ] [ WaterGun ] -> [ PlayerD | > FloodingD ] [ WaterGun ] sfx8
left  [ action PlayerL |    Water ] [ WaterGun ] -> [ PlayerL | > FloodingL ] [ WaterGun ] sfx8
right [ action PlayerR |    Water ] [ WaterGun ] -> [ PlayerR | > FloodingR ] [ WaterGun ] sfx8
[ action Player ] [ canMove WaterGun ] -> [ Player ] [ canMove WaterGun ] sfx6
late up    [ PlayerU | no Flooding ] [ WaterGun no canMove ] -> [ PlayerU | Water ] [ WaterGun ] sfx8
late down  [ PlayerD | no Flooding ] [ WaterGun no canMove ] -> [ PlayerD | Water ] [ WaterGun ] sfx8
late left  [ PlayerL | no Flooding ] [ WaterGun no canMove ] -> [ PlayerL | Water ] [ WaterGun ] sfx8
late right [ PlayerR | no Flooding ] [ WaterGun no canMove ] -> [ PlayerR | Water ] [ WaterGun ] sfx8
late [ Player ] [ no canMove WaterGun ] -> [ Player ] [ canMove WaterGun ]
[ > Flooding | WaterBlocker ] -> [ Flooding | WaterBlocker ]
[ > Flooding | stationary Water ] -> [ > Water | > Flooding ]
(sinking animation)
[ WaterSinking4 ] -> [ Water ]
[ WaterSinking3 ] -> [ WaterSinking4 ]
[ WaterSinking2 ] -> [ WaterSinking3 ]
[ WaterSinking1 ] -> [ WaterSinking2 ]
[ WaterDrown1   ] -> [ WaterSinking2 ]
[ WaterSinking0 ] -> [ WaterSinking1 ]
[ WaterDrown0   ] -> [ WaterDrown1   ]
(water interacts with stuff)
late [ AnyWater Crate     ] -> [ WaterSinking0 ] sfx9
late [ AnyWater Drownable ] -> [ WaterDrown0   ] sfx9
late [ AnyWater WaterBlocker ] -> [ WaterBlocker ]
[ > Water | stationary Zombie ] -> [ > Water | > Zombie ]
[ > Flooding | stationary Zombie ] -> [ > Flooding | > Zombie ]

(move crates)
[ > Pusher | stationary Pushable ] -> [ > Pusher | > Pushable ]

(zombies)
[ PlayerU | ZombieAsleep ] -> [ stationary ZombiePlayerU | ZombieAwake ] sfx1
[ PlayerD | ZombieAsleep ] -> [ stationary ZombiePlayerD | ZombieAwake ] sfx1
[ PlayerL | ZombieAsleep ] -> [ stationary ZombiePlayerL | ZombieAwake ] sfx1
[ PlayerR | ZombieAsleep ] -> [ stationary ZombiePlayerR | ZombieAwake ] sfx1

(werewolves)
up    [ stationary Werewolf GoU | no Direction ] -> [ > Werewolf | GoU ]
down  [ stationary Werewolf GoD | no Direction ] -> [ > Werewolf | GoD ]
left  [ stationary Werewolf GoL | no Direction ] -> [ > Werewolf | GoL ]
right [ stationary Werewolf GoR | no Direction ] -> [ > Werewolf | GoR ]
up    [ stationary Werewolf | GoU WerewolfFood ] -> [ > Werewolf | ] sfx1
down  [ stationary Werewolf | GoD WerewolfFood ] -> [ > Werewolf | ] sfx1
left  [ stationary Werewolf | GoL WerewolfFood ] -> [ > Werewolf | ] sfx1
right [ stationary Werewolf | GoR WerewolfFood ] -> [ > Werewolf | ] sfx1
[ Vision ] -> [ ]
[ Target ] -> [ ]
[ stationary Werewolf no Direction | no Obstacle no Vision | ... | WerewolfFood ] -> [ Werewolf | > Vision | ... | WerewolfFood ]
[ > Vision | no Obstacle no Vision ] -> [ | > Vision ]
[ > Vision | Zombie ] -> [ > HiLevelTarget | Zombie ]
[ > Vision | Player ] -> [ > LoLevelTarget | Player ]
[ no Werewolf | > Target ] -> [ > Target | ]
up    [ stationary Werewolf | > HiLevelTarget ] -> [ > Werewolf | GoU ]
down  [ stationary Werewolf | > HiLevelTarget ] -> [ > Werewolf | GoD ]
left  [ stationary Werewolf | > HiLevelTarget ] -> [ > Werewolf | GoL ]
right [ stationary Werewolf | > HiLevelTarget ] -> [ > Werewolf | GoR ]
[ stationary Werewolf no Direction | WerewolfFood ] -> [ > Werewolf | no Direction ] sfx1
up    [ stationary Werewolf | > LoLevelTarget ] -> [ > Werewolf | GoU ]
down  [ stationary Werewolf | > LoLevelTarget ] -> [ > Werewolf | GoD ]
left  [ stationary Werewolf | > LoLevelTarget ] -> [ > Werewolf | GoL ]
right [ stationary Werewolf | > LoLevelTarget ] -> [ > Werewolf | GoR ]

late [ Player ] -> [ Player Winning ]
late [ Monster ] [ Winning ] -> [ Monster ] [ ]
late [ Animation ] [ Winning ] -> [ Animation ] [ ]
late [ SnakeHead no previousHead ] [ Winning ] -> [ SnakeHead ] [ ]
late [ Player Gun ] -> Win
late [ Lines ] -> Win

[]->[] again (let's hope there's no infinite loop)

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

Some Winning

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

message Oh no. Zombies!

1######
#zl...#
#..z..#
#p...g#
#..z..#
#..u..#
#..x..#
#######

message What's this?

............
.......tq...
......y.ti..
.....t.y.t..
....y.t.y...
...t.y.t....
..y.t.yi....
..qyyeqy....
...eq..q....
.....q..r...
......qy....
............

message A snake gun! Just what I needed.

1######
#zl...#
#..z..#
#....s#
#..z..#
#..u..#
#..x..#
#######

message Take that, zombie scum!

2########
#.......#
#.#.z.#.#
#..z.z..#
#.......#
#.......#
#.s.#...#
#.......#
#...z...#
#########

message Victory, thy name is snake gun!

3######
#z..#z#
#...z.#
#.s...#
#.....#
#.c...#
#..#..#
#######

message Oh no. Werewolves!

4######
#..w.w#
#z....#
#c#...#
#sc...#
#######

message I'm almost out of snake bullets!

5######
#..w..#
#....z#
#w....#
##s..##
#.....#
#.c...#
#.....#
#######

message There's only one snake left.

6############
#.c....w....#
#z#.....w.w.#
#.c.cz......#
#...........#
#...........#
#.#...w.....#
#s..........#
#############

message What do I do now? Without snakes?

7#######
#g.....#
#..w...#
#.c....#
#..~...#
#..~..w#
#p.#...#
########

message What's this? Another snake gun?

............
......tq....
......rtq...
...tqy.r.r..
...r..y.y...
..y.te.t....
.t.y..yi....
.qt.teqy....
..eeq..i....
.....i..r...
......qy....
............

(water gun, snake gun gun, snake rocket launcher, crowbar, explosive werewolf food gun...)
message No, it's an ocean gun!

7#######
#o.....#
#.cw...#
#......#
#..~...#
#..~...#
#..#...#
########

message I wonder if zombies can swim.

8########
#....o..#
#.......#
#.z.....#
#.....z.#
#w......#
#......w#
#########

message Take that, werewolf scum!

9#########
##.....w##
#w.......#
#........#
#...z....#
#.z.....z#
#...cc...#
##...o..##
##########

message I'm almost out of water!

10########
#....o...#
#........#
#.z.....z#
#...z....#
#........#
#w.......#
##########

message Only a few monsters are left.
message But I ran out of bullets.
message What shall I do?

11##########
#"##......w#
###..p.....#
##....c....#
#..........#
#..z..z....#
#z......z..#
#z.z.......#
#.........~#
#........~~#
#.....z.~~~#
############

message A noble sacrifice.
message Thanks for playing!
message THE END