function Creature(px, py, pname, pid, pwidth, pheight, pPoints, pDivRef, pimage){
	this.base = ScreenObject;
	this.base(px,py,pname,pid,pwidth,pheight,pDivRef,pimage);

	this.pointValue = pPoints;
	this.status;
	
	this.moveType;
	this.pattern;
	this.patCount = 0;
	
	this.moveYcount = 0;
	this.moveYthresh = 0;
	
	this.counter=0;
	this.threshold=0;

	this.move = function(){
		if(this.status!=0){
			switch(this.moveType){
				case kMovePat:
					if(gamePatterns[this.pattern][this.patCount]!=-99){
						if(this.moveYcount==0){
							this.moveYthresh=gamePatterns[this.pattern][this.patCount+1];
							}			
						this.y-=gamePatterns[this.pattern][this.patCount];
						if(++this.moveYcount==this.moveYthresh){
							this.moveYcount=0;
							this.patCount+=2;
						}
					}
					else 
						this.patCount=0;
					this.x-=this.xspeed;
					break;
				case kMoveSine:
					this.x-=this.xspeed;
					if(this.x<-50){
						this.x=TheGame.screenWidth+100;
						this.xspeed=Math.floor(Math.random()*6)+1
						this.y=Math.floor(Math.random()*TheGame.screenHeight);
					}
					this.y+=Math.sin(this.counter)*this.yspeed;
					this.counter+=0.2;
					if(this.counter>5000)this.counter=0;
					break;
			}		 

		}
	}
	
	this.remove = function(){
		this.status=0;
		this.x=-this.width*2;
		this.y=-this.height*2;
		this.draw();
	}
	
	this.checkCol = function(objThing){
		if(((this.x>=objThing.x&&this.x<objThing.x+objThing.width)||(this.x+this.width>=objThing.x&&this.x+this.width<objThing.x+objThing.width))&&((this.y>=objThing.y&&this.y<objThing.y+objThing.height)||(this.y+this.height>=objThing.y&&this.y+this.height<objThing.y+objThing.height))){
			this.remove();
			return true;
		}
	}
}


/*----- Blobby creature ------*/
function CreatureUFO(px, py, pid, pDivRef){
	this.base = Creature;
	this.base(px, py, "xwing", pid, 25, 25, 15, pDivRef, "bad3.gif");
	
	this.xspeed=10;
	this.yspeed=3;
}

/*------Red crabby thing--------*/
function CreatureCrab(px, py, pid, pDivRef){
	this.base = Creature;
	this.base(px,py,"crab",pid,25,25,22,pDivRef,"bad2.gif");

	this.xspeed=9;
	this.yspeed=3;
}

/*----- Blue creature ------*/
function CreatureBlue(px, py, pid, pDivRef){
	this.base = Creature;
	this.base(px, py, "blue", pid, 25, 25, 10, pDivRef, "bad1.gif");
	
	this.xspeed=8;
	this.yspeed=3;
	
}

/*----- The Rock creature ------*/
function CreatureRock(px, py, pid, pDivRef){
	this.base = Creature;
	this.base(px, py, "rock", pid, 52, 37, 1, pDivRef, "rock.gif");
	
	this.xspeed=Math.floor(Math.random()*6)+2;
	this.yspeed=1;
	
	this.remove=function(){}
}
