当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle.getY方法代码示例

本文整理汇总了Java中org.newdawn.slick.geom.Rectangle.getY方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getY方法的具体用法?Java Rectangle.getY怎么用?Java Rectangle.getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.geom.Rectangle的用法示例。


在下文中一共展示了Rectangle.getY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSomethingBlocking

import org.newdawn.slick.geom.Rectangle; //导入方法依赖的package包/类
public boolean isSomethingBlocking(Rectangle rectangle) {
    	int x = (int)(rectangle.getX() / mTmxMap.getTilewidth());
    	int y = (int)(rectangle.getY() / mTmxMap.getTileheight());
    	int endX = (int)((rectangle.getX() + rectangle.getWidth()) / mTmxMap.getTilewidth());
    	int endY = (int)((rectangle.getY() + rectangle.getHeight()) / mTmxMap.getTileheight());
    	int mapX = mTmxMap.getWidth();
    	int mapY = mTmxMap.getHeight();
    	
//    	System.out.println(mapX + ", " + mapY);
    	if (x >= mapX || y >= mapY) {
    	    return true;
    	}
    	
    	for (; x < endX; ++x) {
        	for (; y < endY; ++y) {
        	    MapElement m = getMapElement(x, y);
        		if (m != null && m.isBlocking()) {
        			return true;
        		}
        	}
    	}
    	
    	return false;
    }
 
开发者ID:AlexMog,项目名称:MMO-Rulemasters-World,代码行数:25,代码来源:Map.java

示例2: intersect

import org.newdawn.slick.geom.Rectangle; //导入方法依赖的package包/类
/**
 * Verifica se houve interse��o entre dois ret�ngulos.
 * @param r1 Ret�ngulo 1.
 * @param r2 Ret�ngulo 2.
 * @return Valor booleano indicando se houve interse��o.
 */
public static boolean intersect(Rectangle r1, Rectangle r2) {
	/* Ocorre colis�o se:
	 * !(left > other.right || right < other.left ||
	 *	top > other.bottom || bottom < other.top)
	 */		
	return !((r1.getX() > (r2.getX() + r2.getWidth()) || (r1.getX() + r1.getWidth()) < r2.getX()) ||
			(r1.getY() > (r2.getY() + r2.getHeight()) || (r1.getY() + r1.getHeight()) < r2.getY()));		
}
 
开发者ID:intentor,项目名称:telyn,代码行数:15,代码来源:Utils.java

示例3: isInsideBox

import org.newdawn.slick.geom.Rectangle; //导入方法依赖的package包/类
int isInsideBox(){
    int mX = Mouse.getX(),
        mY = gc.getHeight()-Mouse.getY(),
        i = 0;
    for(Rectangle rect : rects){
        if (mX > rect.getX() && mX < rect.getX()+rect.getWidth() && mY > rect.getY() && mY < rect.getY()+rect.getHeight()){
            return i;
        }
        i++;
    }
    return -1;
}
 
开发者ID:Piratkopia13,项目名称:Pixel-Planet,代码行数:13,代码来源:GUI.java

示例4: getIndex

import org.newdawn.slick.geom.Rectangle; //导入方法依赖的package包/类
private int getIndex(Rectangle rectangle) {
  int index = -1;
  double verticalMidpoint = bounds.getX() + (bounds.getWidth() / 2);
  double horizontalMidpoint = bounds.getY() + (bounds.getHeight() / 2);
  Rectangle pRect = rectangle;

  // Object can completely fit within the top quadrants
  boolean topQuadrant = (pRect.getY() < horizontalMidpoint && pRect.getY() + pRect.getHeight() < horizontalMidpoint);
  // Object can completely fit within the bottom quadrants
  boolean bottomQuadrant = (pRect.getY() > horizontalMidpoint);

  // Object can completely fit within the left quadrants
  if (pRect.getX() < verticalMidpoint && pRect.getX() + pRect.getWidth() < verticalMidpoint) {
     if (topQuadrant) {
       index = 1;
     }
     else if (bottomQuadrant) {
       index = 2;
     }
   }
   // Object can completely fit within the right quadrants
   else if (pRect.getX() > verticalMidpoint) {
    if (topQuadrant) {
      index = 0;
    }
    else if (bottomQuadrant) {
      index = 3;
    }
  }

  return index;
}
 
开发者ID:jubilee145,项目名称:APFG,代码行数:33,代码来源:Quadtree.java

示例5: use

import org.newdawn.slick.geom.Rectangle; //导入方法依赖的package包/类
@Override
public void use(Player p) {

	Rectangle rec = new Rectangle(p.getPos().x + 16, p.getPos().y + 16, 0.1f, 0.1f);
	Vector2f startLocation = p.getPos().copy();
	startLocation.add(new Vector2f(16, 16));
	Vector2f v = new Vector2f(p.getLookAngle()).normalise();

	boolean t = true;

	ArrayList<Shape> a = SaboteurServer.instance.getMap().getCollisionShapes();
	ArrayList<Player> players = SaboteurServer.instance.getPlayers();

	while (t) {

		rec.setLocation(startLocation.add(v));

		for (Shape r : a) {
			if (r.intersects(rec)) {
				t = false;
				System.out.println("Punkt kollidiert mit Block " + r.getX() + "  " + r.getY());
				break;
			}
		}

		for (Player player : players) {
			if (rec.intersects(player.getCollisionBox())) {
				if (player.getId() != p.getId()) {
					t = false;
					System.out.println("Punkt kollidiert mit Spieler " + player.getId());
					player.damage(10, player, 0);
					break;
				}
			}
		}

		if (rec.getX() < 0 || rec.getX() > 1280 || rec.getY() < 0 || rec.getY() > 1024)
			t = false;

	}

}
 
开发者ID:JavaJumperStudios,项目名称:Saboteur,代码行数:43,代码来源:Gun.java


注:本文中的org.newdawn.slick.geom.Rectangle.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。