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

📄 gmautomatic.java

📁 坦克游戏
💻 JAVA
字号:
/*
 * Created on 2005-3-11
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package components;

import java.util.Vector;
import java.awt.Image;

/**
 * @author Emtry Immortal
 * 
 * 动画效果
 */
public abstract class GmAutomatic extends GmComponent {

	protected int iCurrFrame = 0;

	protected int iMaxFrames = 1;

	protected boolean isPlaying = false;

	protected Image[] images = null;

	/**
	 * @param life
	 * @param ptX
	 * @param ptY
	 * @param container
	 */
	public GmAutomatic(long life, double ptX, double ptY, Vector container) {
		super(life, ptX, ptY, container);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see components.GmComponent#updateOject()
	 */
	public void updateOject() {
		if (isPlaying) {
			iCurrFrame = (iCurrFrame + 1) % iMaxFrames;
		}
		super.updateOject();
	}

	/**
	 * @return Returns the iFrameNum.
	 */
	public int getCurrFrame() {
		return iCurrFrame;
	}

	/**
	 * @param frameNum
	 *            The iFrameNum to set.
	 */
	public void setFrameNum(int frameNum) {
		iCurrFrame = frameNum;
	}

	public void play() {
		isPlaying = true;
	}

	public void pause() {
		isPlaying = false;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see components.GmComponent#isSuperpose(int, int, int, int)
	 */
	public boolean isSuperpose(int left, int top, int width, int height) {
		if (this.ptX > left && this.ptX < (left + width) && this.ptY > top
				&& this.ptY < (top + height)) {
			return true;
		}
		return false;
	}
}

⌨️ 快捷键说明

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