Ejemplo n.º 1
0
bool Zombie::operator ==(const Zombie& assignThis){
    
    bool retVal = false; //fix this in future to compare differently, this will be a bug as is when we ceate graphics but i have no other way at the moment
    
    if (getX() == assignThis.getX()
        &&
        getY() == assignThis.getY()
        &&
        getZ() == assignThis.getZ()) {
        
        retVal = true;
    }
    
    return retVal;
}
Ejemplo n.º 2
0
bool Helper::hitArea(const Bullet& o1, const Zombie& o2) const{
	 double X = o2.getX();
	 double Y = o2.getY();
	 double size = (double)o2.getSize();
	
	 double vertexX = o1.getX()-(o1.getSize()/2);
	 double vertexY = o1.getY()-(o1.getSize()/2);
     
     if (vertexX > X - (size/2) &&
	     vertexX < X + (size/2) && 
		 vertexY > Y - (size/2) && 
		 vertexY < Y + (size/2)){
         return true;
     }

	 vertexX = o1.getX() + (o1.getSize()/2);
	 vertexY = o1.getY() - (o1.getSize()/2);

     if (vertexX > X - (size/2) &&
	     vertexX < X + (size/2) && 
		 vertexY > Y - (size/2) && 
		 vertexY < Y + (size/2)){
         return true;
     }
	 
	 vertexX = o1.getX() - (o1.getSize()/2);
	 vertexY = o1.getY() + (o1.getSize()/2);
	 
     if (vertexX > X - (size/2) &&
	     vertexX < X + (size/2) && 
		 vertexY > Y - (size/2) && 
		 vertexY < Y + (size/2)){
         return true;
     }
     
	 vertexX = o1.getX()+(o1.getSize()/2);
	 vertexY = o1.getY()+(o1.getSize()/2);
	 
     if (vertexX > X - (size/2) &&
	     vertexX < X + (size/2) && 
		 vertexY > Y - (size/2) && 
		 vertexY < Y + (size/2)){
         return true;
     }
     
	 return false;
};