rect.java

来自「经典FC游戏《超惑星战记》的J2ME版本!!功能基本上都实现了」· Java 代码 · 共 28 行

JAVA
28 行
字号
/**
 * <p>Title: Transpanzer</p>
 * <p>Description:
 * You cannot remove this copyright and notice.
 * You cannot use this file any part without the express permission of the author.
 * All Rights Reserved</p>
 * @author Jjyo
 * @email jjyo@163.com
 * @version 1.0.0
 */

public class Rect {
	public int x; // 矩形的左上角X坐标
	public int y; // 矩形的左上角Y坐标
	public int dx; // 矩形的宽
	public int dy; // 矩形的高

	//矩形相交检测
	public static boolean IntersectRect(Rect rect1, Rect rect2) {
		if ((rect1.x + rect1.dx > rect2.x) && (rect1.y + rect1.dy > rect2.y)
				&& (rect2.x + rect2.dy > rect1.x)
				&& (rect2.y + rect2.dy > rect1.y)) {
			return true;
		}
		return false;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?