⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maprect.java

📁 简单的用Java做的小游戏主要是用了自己的框架来
💻 JAVA
字号:
package assistant;
import java.awt.Rectangle;

/**
 * 地图区域类
 * @author Administrator
 *
 */
public class MapRect extends Rectangle{
	/**
	 * 
	 */
	private static final long serialVersionUID = -976905116370274871L;
	/**判断是否是底层区域*/
	public boolean isDown;
	
	/**
	 * 构造方法
	 * @param x X坐标
	 * @param y Y坐标
	 * @param width 宽度
	 * @param height 高度
	 * @param isDown 是否是底层域
	 */
	public MapRect(int x,int y,int width,
			int height,boolean isDown){
		super(x, y, width, height);
		this.isDown = isDown;
	}
	
	/**
	 * 设置区域随地图移动
	 * @param state 设置区域移动方向
	 * @param speed 设置区域移动速度
	 */
	public void moveByMap(int state,int speed){
		if(state ==  PublicVar.RIGHT){
			this.x+=speed;
		}
		if(state ==  PublicVar.UP){
			this.y+=speed;
		}
		
		if(this.x<=this.width*-1 || this.y>=550){
			PublicVar.rectList.remove(this);
		}
	}
}

⌨️ 快捷键说明

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