Exemple #1
0
	   private Boolean checkCollision(Objeto obj1,Objeto obj2){
	   		Boolean col = obj1.boxCollision.Intersects(obj2.boxCollision);
	   		if (col==true){
	   			if (obj1.precise || obj2.precise){
	        		//add espaço vazio do bbox no rect:
        			Rectangle rect1 = obj1.boxCollision;
        			rect1.X-=obj1.sprite.box[obj1.sprite.ImageIndex].X;
        			rect1.Y-=obj1.sprite.box[obj1.sprite.ImageIndex].Y;
        			rect1.Width=obj1.sprite.WidthOrig;
        			rect1.Height=obj1.sprite.HeightOrig;
        			Rectangle rect2 = obj2.boxCollision;
        			rect2.X-=obj2.sprite.box[obj2.sprite.ImageIndex].X;
        			rect2.Y-=obj2.sprite.box[obj2.sprite.ImageIndex].Y;
        			rect2.Width=obj2.sprite.WidthOrig;
        			rect2.Height=obj2.sprite.HeightOrig;
        			//testar colisão precisa com as novas box de colisão com bbox:
	        		col = IntersectsPixel2(rect1,obj1.sprite.textureDatas[sprite.ImageIndex],rect2,obj2.sprite.textureDatas[sprite.ImageIndex],obj1.precise,obj2.precise);	   			
	   			}				
        	}
	   		return col;
	   }
Exemple #2
0
	   public Boolean CollisionInstancesOk(Objeto obj1,Objeto obj2){
	   		return checkCollision(obj1,obj2);//obj1.boxCollision.Intersects(obj2.boxCollision);	   		
	   }