name	         Crumbler
health	         1
type	         enemy
nomove		 1 1
subject_to_gravity	 0
lifespan	 30
animationscript  data/scripts/oscript.c
load	         Debris
load	         DPipa
load	         Rocks


anim idle
	loop	1
	delay	20
	offset	1 1
        frame   data/chars/misc/empty.gif
	@cmd	anichange "ANI_FOLLOW1"
        frame   data/chars/misc/empty.gif

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

    if( frame == 0){
      int r = rand()%30;
      if( r > 10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
      } else if( r < -10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
      }
    }
@end_script
	loop	1
	delay	1
	offset	1 1
        frame   data/chars/misc/empty.gif
	delay	400
	@cmd	Rspawn "Rocks" 240 0 200 30 480
        frame   data/chars/misc/empty.gif

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

    if( frame == 0){
      int r = rand()%30;
      if( r > 10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
      } else if( r < -10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
      }
    }
@end_script
	loop	1
	delay	1
	offset	1 1
        frame   data/chars/misc/empty.gif
	delay	400
	@cmd	Rspawn "DPipa" 240 0 200 30 480
        frame   data/chars/misc/empty.gif

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

    if( frame == 0){
      int r = rand()%30;
      if( r > 10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
      } else if( r < -10){
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
	loop	1
	delay	1
	offset	1 1
        frame   data/chars/misc/empty.gif
	delay	400
	@cmd	Rspawn "Debris" 240 0 200 30 480
        frame   data/chars/misc/empty.gif
