當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle.overlaps方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.math.Rectangle.overlaps方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle.overlaps方法的具體用法?Java Rectangle.overlaps怎麽用?Java Rectangle.overlaps使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.math.Rectangle的用法示例。


在下文中一共展示了Rectangle.overlaps方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: query

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
			if(type == -1) {
				// this is root node
				ret.addAll(objs);
			}
			
			if(!rect.overlaps(_rect)) {		//������ýڵ㲻�ཻ��ֱ���˳�
				
				return;
			}
			
//			System.out.println("query node : success -------------------");
			//�ڵ�ռ�Ҳ��Ŷ���ͨ���ཻ������ȫ�����
			for(int i = objs.size - 1; i >= 0; --i) {
				ret.add(objs.get(i));
			}
//			ret.addAll(objs);
			
			if(sides != null) {
				//�����߿ռ�
				for(int i = 0; i < sides.length; ++i) {
					//��Ҫ�߶��Լ�ȥ�ж��Ƿ���������
					sides[i].query(rect, ret);
				}
			}
			
			if(children != null) {
				for(int i = 0; i < children.length; ++i) {
					children[i].query(rect, ret);
				}
			}
		}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:33,代碼來源:QuadTreeV2.java

示例2: slowQuery

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public void slowQuery(Rectangle rect, final Array<IQuadTreeObject> ret) {
	for(int i = 0, n = tempObjects.size; i < n; ++i) {
		final IQuadTreeObject o = tempObjects.get(i);
		if(rect.overlaps(o.getRectangle())) {
			ret.add(o);
		}
	}
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:9,代碼來源:QuadTreeV2.java

示例3: query

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
			if(type == -1) {
				// this is root node
				ret.addAll(objs);
			}
			
			if(!rect.overlaps(_rect)) {		//������ýڵ㲻�ཻ��ֱ���˳�
				
				return;
			}
			
//			System.out.println("query node : success -------------------");
			
			if(this.children == null || sides == null) {
				//û���ӽڵ� ������ж�����˳�
				ret.addAll(objs);
				return;
			}
			
			if(sides != null) {
				//�����߿ռ�
				for(int i = 0; i < sides.length; ++i) {
					//��Ҫ�߶��Լ�ȥ�ж��Ƿ���������
					sides[i].query(rect, ret);
				}
			}
			
			if(children != null) {
				for(int i = 0; i < children.length; ++i) {
					children[i].query(rect, ret);
				}
			}
		}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:34,代碼來源:QuadTree.java

示例4: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle bird){

        if(bird.overlaps(boundsTop) || bird.overlaps(boundsBot)){
            return true;
        }
        
        return false;
    }
 
開發者ID:RubenMateus,項目名稱:FlappyChapa,代碼行數:9,代碼來源:Tube.java

示例5: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle bird){

        if(bird.overlaps(boundsTop)){
            return true;
        }

        return false;
    }
 
開發者ID:RubenMateus,項目名稱:FlappyChapa,代碼行數:9,代碼來源:Anto.java

示例6: setContacts

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public void setContacts(Array<Tile> tiles) {
    Rectangle bounds = new Rectangle(rectangle);
    bounds.setSize(rectangle.width + 2, rectangle.height + 2);
    bounds.setPosition(rectangle.x - 1, rectangle.y - 1);

    for (Tile t : tiles) {
        if (t == this) continue;
        if (bounds.overlaps(t.getRectangle())) {
            contacts.add(new Contact(this, t));
            neighbors.add(t);
        }
    }
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:14,代碼來源:Tile.java

示例7: Meteorite

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public Meteorite(Sprite[] textures, Sprite[] warning, Sound sound) {
    super(0, 0);
    this.sound = sound;
    Random r = new Random();
    int direction = r.nextInt(360 + 1);
    health = r.nextInt(2) + 3;

    float tempVelY = (float) (10 * Math.cos(Math.toRadians(direction)));
    float tempVelX = (float) (10 * Math.sin(Math.toRadians(direction)));

    if (r.nextInt(2) == 0)
        tempVelX *= -1;
    if (r.nextInt(2) == 0)
        tempVelY *= -1;
    Rectangle collision = new Rectangle((int) GameScreen.earth.getXCenter(),
            (int) GameScreen.earth.getYCenter(), radius * 2, radius * 2);
    Rectangle screen = new Rectangle(0, 0, Game.WIDTH, Game.HEIGHT);
    while (collision.overlaps(screen)) {
        collision.setPosition(collision.x + tempVelX, collision.y + tempVelY);
    }
    warningRect = new Rectangle(collision.x, collision.y, 50, 50);
    while (!warningRect.overlaps(screen)) {
        warningRect.setPosition(collision.x - tempVelX * 15, collision.y - tempVelY * 15);
    }
    x = (float) collision.getX();
    y = (float) collision.getY();
    float xSpeed = (Game.WIDTH / 2 - x) / 1.0f;
    float ySpeed = (Game.HEIGHT / 2 - y) / 1.0f;
    float factor = (float) (speed / Math.sqrt(xSpeed * xSpeed + ySpeed * ySpeed));
    xSpeed *= factor;
    ySpeed *= factor;

    velX = xSpeed;
    velY = ySpeed;
    this.collision = new Circle(x - radius, y - radius, radius);
    this.img = textures;
    this.warning = warning;
    warningTime = System.currentTimeMillis() + 3000;
}
 
開發者ID:MrGussio,項目名稱:EarthInvadersGDX,代碼行數:40,代碼來源:Meteorite.java

示例8: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player){
    if ((player.overlaps(boundsMud ) && !collided)) {
        collided = true;
        return true;
    }
    else{
        return false;
    }
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:10,代碼來源:Mud.java

示例9: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player) {
    if ((player.overlaps(boundsPoop) && !collided)) {
        collided = true;
        return true;
    } else {
        return false;
    }
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:9,代碼來源:Poop.java

示例10: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player) {
    if ((player.overlaps(barrelBounds) && !collided)){
        collided = true;
        return true;
    }
    else{
        return false;
    }
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:10,代碼來源:Barrel.java

示例11: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player) {
    if (player.overlaps(boundsObs) && !hasCollided) {
        hasCollided = true;
        return true;
    }
    else {
        return false;
    }
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:10,代碼來源:Obstacle.java

示例12: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player){
    if (((player.overlaps(cherryBounds)))&& !collided) {
        collided = true;
        return true;
    }
    else{
        return false;
    }
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:10,代碼來源:Cherry.java

示例13: intersectsWith

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public static boolean intersectsWith(Rectangle rectangle1, Rectangle rectangle2)
{
    return (rectangle1.overlaps(rectangle2));
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:5,代碼來源:SIUtils.java

示例14: collides

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public boolean collides(Rectangle player){
    return player.overlaps(boundsTop) || player.overlaps(boundsBot);
}
 
開發者ID:kirdmiv,項目名稱:Flappy-Baranus,代碼行數:4,代碼來源:Tube.java

示例15: testRectangleRectangleCollision

import com.badlogic.gdx.math.Rectangle; //導入方法依賴的package包/類
public static boolean testRectangleRectangleCollision(Rectangle rect1, Rectangle rect2) {
    return rect1.overlaps(rect2);
}
 
開發者ID:opensourcegamedev,項目名稱:SpaceChaos,代碼行數:4,代碼來源:ColliderUtils.java


注:本文中的com.badlogic.gdx.math.Rectangle.overlaps方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。