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

📄 beginchip.java

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

import java.awt.Image;

import assistant.MoveImageChange;
import assistant.PublicVar;

public class BeginChip extends SportRole {
	/** 图片切换对象 */
	private MoveImageChange moveImageChange = new MoveImageChange(20);

	/** 图片快速切换对象 */
	private MoveImageChange moveLoveImageChange = new MoveImageChange(5);

	private Image[] moveRightImage = { Chip.chipImage[0][1],
			Chip.chipImage[0][2], Chip.chipImage[0][3] };

	/** 移动计数器 */
	private int moveCount;

	/** 是否站立 */
	private boolean isStand;
	
	/** 心角色 */
	private ChipHart chipHart;

	private int count;
	
	/**
	 * 构造方法
	 * @param x   X坐标
	 * @param y   Y坐标
	 * @param state  松鼠状态
	 */
	public BeginChip(int x, int y, int state) {
		super(x, y, 40, 40, state);

	}
	public void move() {
		
		if (ChipHart.isStop == false) {
			if (this.isStand == false) {
				this.img = moveImageChange.imageChange(moveRightImage);
				moveCount++;

				if (moveCount == 3) {
					this.x += 3;
					this.y -= 1;
					moveCount = 0;
				}
				if (this.x > 380) {
					this.x = 380;			
					this.img = Chip.chipImage[0][0];
					this.isStand = true;
					this.chipHart = new ChipHart(this.x + 5, this.y - 35);		
					PublicVar.roleList.add(chipHart);				
				}
			} 
			else {

				this.chipHart.setState(1);
				if(ChipHart.isAlpha == false){
					this.img = Chip.chipImage[0][5];
				}
				
			}
		} 
		else {	
			count ++;
			if(count>220){
				if (Monster.isTakeChip) {
					this.img = moveLoveImageChange.imageChange(moveRightImage);
					this.x += 6;
					this.y += 2;
				}
			}else{
				moveCount++;
				this.img = moveImageChange.imageChange(moveRightImage);
				if (moveCount == 3) {
					this.x += 1;
					moveCount = 0;
				}
			}
		}
		
	}

}

⌨️ 快捷键说明

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