name	 	Satellite
health		400
type		enemy
nomove		1 1
nodrop		2
nopain		1
nodieblink	2
facing		2
death		1
antigravity	100
animationscript	data/chars/cobras/jetsc.c
takedamagescript data/scripts/blink.c

load		CLaser
load		JetBullet

palette		data/chars/cobras/satellite.png
alternatepal	data/chars/cobras/satblink.png


anim spawn
	delay	1
	offset	75 115
	frame	data/chars/cobras/satellite.png
	delay	80
	@cmd	dasher -2 0 0 0
	frame	data/chars/cobras/satellite.png

anim idle
	loop    1
	delay	1
	offset	75 115
	frame	data/chars/cobras/satellite.png
	@cmd	attack0 "ANI_FOLLOW1"
	frame	data/chars/cobras/satellite.png

anim follow1
@script
    void vSelf = getlocalvar("self");	

    if(frame==0){
      int MHealth = getentityproperty(vSelf,"maxhealth");
      int Health = getentityproperty(vSelf,"health");
      int r = rand()%30;

      if(Health <= MHealth/2){
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW3"));
      } else if( r > 0){
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW2"));
      }
    }
@end_script
	loop    1
	delay	1
	offset	75 115
	bbox	12 93 110 42
	attack	0
	@cmd	dasher 0 0 0 0
	frame	data/chars/cobras/satellite.png
	delay	50
	attack	12 93 110 42 200
	@cmd	dasher 0 -1 0 0
	frame	data/chars/cobras/satellite.png
	delay	25
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	8
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 21 56 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -56 1.5 0
	frame	data/chars/cobras/satellite.png
	@cmd	shooter2 "JetBullet" 21 75 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -75 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	9
	@cmd	shooter2 "JetBullet" 21 95 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -95 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	50
	@cmd	dasher 0 1 0 0
	frame	data/chars/cobras/satellite.png
	frame	data/chars/cobras/satellite.png #
	frame	data/chars/cobras/satellite.png
	delay	25
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	8
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 21 56 1.5 0
	@cmd	shooter2 "JetBullet" 21 -56 1.5 0
	frame	data/chars/cobras/satellite.png
#	@cmd	shooter2 "JetBullet" 21 75 1.5 0
	@cmd	shooter2 "JetBullet" 21 -75 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	9
#	@cmd	shooter2 "JetBullet" 21 95 1.5 0
	@cmd	shooter2 "JetBullet" 21 -95 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	100
	@cmd	dasher 0 -1 0 0
	frame	data/chars/cobras/satellite.png

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

    if(frame==0){
      int MHealth = getentityproperty(vSelf,"maxhealth");
      int Health = getentityproperty(vSelf,"health");
      int r = rand()%30;

      if(Health <= MHealth/2){
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW3"));
      } else if( r > 0){
        changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
	loop    1
	delay	1
	offset	75 115
	bbox	12 93 110 42
	attack	0
	@cmd	dasher 0 0 0 0
	frame	data/chars/cobras/satellite.png
	delay	50
	attack	12 93 110 42 200
	@cmd	dasher 0 1 0 0
	frame	data/chars/cobras/satellite.png
	delay	25
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	8
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 21 56 1.5 0
	@cmd	shooter2 "JetBullet" 21 -56 1.5 0
	frame	data/chars/cobras/satellite.png
#	@cmd	shooter2 "JetBullet" 21 75 1.5 0
	@cmd	shooter2 "JetBullet" 21 -75 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	9
#	@cmd	shooter2 "JetBullet" 21 95 1.5 0
	@cmd	shooter2 "JetBullet" 21 -95 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	50
	@cmd	dasher 0 -1 0 0
	frame	data/chars/cobras/satellite.png
	frame	data/chars/cobras/satellite.png #
	frame	data/chars/cobras/satellite.png
	delay	25
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	8
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 21 56 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -56 1.5 0
	frame	data/chars/cobras/satellite.png
	@cmd	shooter2 "JetBullet" 21 75 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -75 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	9
	@cmd	shooter2 "JetBullet" 21 95 1.5 0
#	@cmd	shooter2 "JetBullet" 21 -95 1.5 0
	frame	data/chars/cobras/satellite.png
	delay	100
	@cmd	dasher 0 1 0 0
	frame	data/chars/cobras/satellite.png

anim follow3
	loop    1
	delay	1
	offset	75 115
	bbox	12 93 110 42
	attack	0
	frame	data/chars/cobras/satellite.png
	delay	20
	attack	12 93 110 42 200
	@cmd	target 4 4 0 0 1 0
	@cmd	dash 0 1
	frame	data/chars/cobras/satellite.png
	@cmd	target 4 4 0 0 1 0
	@cmd	dash 0 1
	frame	data/chars/cobras/satellite.png
	delay	50
	@cmd	dasher 0 0 0 0
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	20
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 32 9 1.5 0.3
	@cmd	shooter2 "JetBullet" 32 -9 1.5 -0.3
	frame	data/chars/cobras/satellite.png
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 32 9 1.5 0.6
	@cmd	shooter2 "JetBullet" 32 -9 1.5 -0.6
	frame	data/chars/cobras/satellite.png
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 32 9 1.5 1
	@cmd	shooter2 "JetBullet" 32 -9 1.5 -1
	frame	data/chars/cobras/satellite.png
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 32 9 1.5 0.6
	@cmd	shooter2 "JetBullet" 32 -9 1.5 -0.6
	frame	data/chars/cobras/satellite.png
	delay	50
	sound	data/sounds/HydraGun.wav
	@cmd	shooter2 "JetBullet" 32 9 1.5 0.3
	@cmd	shooter2 "JetBullet" 32 -9 1.5 -0.3
	frame	data/chars/cobras/satellite.png
	delay	100
	sound	data/sounds/laser.wav
	@cmd	shoot "CLaser" 35 0 0
	frame	data/chars/cobras/satellite.png
	delay	20
	@cmd	target 4 4 0 0 1 0
	@cmd	dash 0 1
	frame	data/chars/cobras/satellite.png


anim death
	delay	1
	offset	75 115
	frame	data/chars/cobras/satellite.png
	delay	20
	@cmd	dasher 0 0 0 0
	@cmd	spawn01 "SpaceXplos" 0 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" -40 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" 0 70 0
	@cmd	spawn01 "SpaceXplos" 0 -70 0
	frame	data/chars/cobras/satellite.png #
	@cmd	spawn01 "SpaceXplos" 0 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" -40 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" 0 70 0
	@cmd	spawn01 "SpaceXplos" 0 -70 0
	frame	data/chars/cobras/satellite.png #
	@cmd	spawn01 "SpaceXplos" 0 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" -40 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" 0 70 0
	@cmd	spawn01 "SpaceXplos" 0 -70 0
	frame	data/chars/cobras/satellite.png #
	@cmd	spawn01 "SpaceXplos" 0 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" -40 0 0
	frame	data/chars/cobras/satellite.png
	@cmd	spawn01 "SpaceXplos" 0 70 0
	@cmd	spawn01 "SpaceXplos" 0 -70 0
	frame	data/chars/cobras/satellite.png #
	@cmd	spawn01 "SpaceXplos" 0 0 0
	@cmd	suicide
	frame	data/chars/cobras/satellite.png
