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

📄 sportrole.java

📁 简单的用Java做的小游戏主要是用了自己的框架来
💻 JAVA
字号:
package role;

import java.awt.Graphics;

import javax.swing.JFrame;

import assistant.PublicVar;

/**
 * 运动角色基类
 * @author Administrator
 *
 */
public abstract class SportRole extends BaseRole {
	
	/**定义角色速度*/
	protected int speed;
	
	/**
	 * 构造方法
	 * @param x
	 * @param y
	 * @param width
	 * @param height
	 * @param state
	 */
	protected SportRole(int x,int y,
			int width,int height,int state){
		super(x,y,width,height,state);
	}
	
	/**
	 * 角色移动方法
	 *
	 */
	abstract public void move();
	
	/**
	 * Method:       drawMyself
	 * Desctiptoin:  绘制自身图形
	 * @param g  :   画笔
	 * @param jf :   窗体画布
	 */
	@Override
	public void drawMyself(Graphics g,JFrame jf){
		this.move();
		
		super.drawMyself(g, jf);
	}
	/**
	 * 移除自身方法
	 *
	 */
	protected void removeThis(){
		if(this.x<this.width * -2	|| this.x>650+this.width ||
				this.y<this.height * -1 || this.y>570){
			PublicVar.roleList.remove(this);
		}
	}
	
}

⌨️ 快捷键说明

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