本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例5: collides
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public boolean collides(Rectangle bird){
if(bird.overlaps(boundsTop)){
return true;
}
return false;
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例13: intersectsWith
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public static boolean intersectsWith(Rectangle rectangle1, Rectangle rectangle2)
{
return (rectangle1.overlaps(rectangle2));
}
示例14: collides
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public boolean collides(Rectangle player){
return player.overlaps(boundsTop) || player.overlaps(boundsBot);
}
示例15: testRectangleRectangleCollision
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public static boolean testRectangleRectangleCollision(Rectangle rect1, Rectangle rect2) {
return rect1.overlaps(rect2);
}