当前位置: 首页>>代码示例>>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;未经允许,请勿转载。