name		 Cobra_Bunker
health		 300
type		 enemy
nomove		 1 1
nopain		 1
nodrop		 1
facing		 1
setlayer	 1
death		 1
nodieblink	 2
score		 5000 -1
defense		 normal2 0 100
defense		 normal3 0 100
animationscript	 data/bgs/field/wall.c
takedamagescript data/scripts/blink.c

palette		 data/bgs/field/bunker.png
alternatepal	 data/bgs/field/bublink.png

load		 FireFly
load		 BCannon
load		 CannonUp


anim spawn
    delay	 1
    offset	 65 188
    platform	 103 215 -290 -184 200 200 100 200
    frame	 data/bgs/field/bunker.png
    delay	 5
    @cmd	 spawnGun "BCannon" -45 105 -20 0
    @cmd	 spawnGun "BCannon" -20 95 -10 1
    @cmd	 spawnGun "BCannon" 10 105 20 2
    @cmd	 spawnGun "CannonUp" -10 165 -10 3
    @cmd	 spawn01 "FireFly" 20 165 5
    frame	 data/bgs/field/bunker.png
    delay	 400
    @cmd	 spawnGun "CannonUp" 40 165 25 4
    frame	 data/bgs/field/bunker.png

anim idle
    delay	 100
    offset	 65 188
    bbox	 36 135 18 19
    platform	 103 215 -290 -184 200 200 100 200
    frame	 data/bgs/field/bunker.png
    @cmd	 attack0 "ANI_FOLLOW1"
    frame	 data/bgs/field/bunker.png

anim follow1
    delay	 1
    offset	 65 188
    bbox	 36 135 18 19
    platform	 103 215 -290 -184 200 200 100 200
    frame	 data/bgs/field/bunker.png
    delay	 100
    @cmd	 anichangeSl 3 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 4 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 3 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    delay	 300
    @cmd	 anichangeSl 4 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichange "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png

anim follow2
@script
    void self = getlocalvar("self");

    if( frame == 0){
      int r = rand()%30;

      if( r > 0){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
      }
    }
@end_script
    delay	 1
    offset	 65 188
    bbox	 36 135 18 19
    platform	 103 215 -290 -184 200 200 100 200
    frame	 data/bgs/field/bunker.png
    delay	 100
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 0 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 2 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 1 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 0 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 2 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    delay	 200
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichange "ANI_FOLLOW1"
    frame	 data/bgs/field/bunker.png

anim follow3
    delay	 1
    offset	 65 188
    bbox	 36 135 18 19
    platform	 103 215 -290 -184 200 200 100 200
    frame	 data/bgs/field/bunker.png
    delay	 150
    @cmd	 anichangeSl 0 "ANI_FOLLOW2"
    @cmd	 anichangeSl 1 "ANI_FOLLOW2"
    @cmd	 anichangeSl 2 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 0 "ANI_FOLLOW3"
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    @cmd	 anichangeSl 2 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichangeSl 0 "ANI_FOLLOW2"
    @cmd	 anichangeSl 1 "ANI_FOLLOW2"
    @cmd	 anichangeSl 2 "ANI_FOLLOW2"
    frame	 data/bgs/field/bunker.png
    delay	 200
    @cmd	 anichangeSl 0 "ANI_FOLLOW3"
    @cmd	 anichangeSl 1 "ANI_FOLLOW3"
    @cmd	 anichangeSl 2 "ANI_FOLLOW3"
    frame	 data/bgs/field/bunker.png
    @cmd	 anichange "ANI_FOLLOW1"
    frame	 data/bgs/field/bunker.png


anim death
    delay	 1
    offset	 65 188
    frame	 data/bgs/field/bunker.png
    delay	 100
    @cmd	 killgun 0 1
    @cmd	 killgun 1 1
    @cmd	 killgun 2 1
    @cmd	 killgun 3 1
    @cmd	 killgun 4 1
    frame	 data/bgs/field/bunker.png
    @cmd	 spawn01 "BXPlos" 0 0 0
    @cmd	 spawn01 "BXPlos" -30 0 -30
    @cmd	 spawn01 "BXPlos" 30 0 30
    frame	 data/chars/misc/empty.gif
    @cmd	 suicide
    frame	 data/chars/misc/empty.gif
