本文整理匯總了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);
}