sprite.java

来自「J2ME程序开发实用例子」· Java 代码 · 共 66 行

JAVA
66
字号
/**
 * 精灵类
 * <p>Title: 精灵类 </p>
 * <p>Description:</p>
 * <p>Copyright: (c) 2007</p>
 * @author QN
 * @version 1.0
 */
public class Sprite {
	public void copyPos(Sprite spt){
		this.x = spt.x;
		this.y = spt.y;
//		this.z = spt.z;
	}
	public Sprite(){
		
	}
	
	//07-05-02
	int[] resList;
	int[] frames;
	int framesCount;
	int curFrame;
	boolean isFrameOver;
	public void nextFrame(){
		if(frames != null){
			curFrame = frames[framesCount++];
			if(framesCount > frames.length - 1){
				framesCount = 0;
				isFrameOver = true;
			}
		}
	}
	
	public int x,y;//,z

	public int w, h,hZ = 5;//精灵宽高
	
	public int vx,vy,ay,vz;//加速度,重力,
	
	public int id,listID = -1;//精灵的ID
	
	public boolean isHide;//不进行绘制	

	public short state,oldState;
	
	private int dir = DIR_RIGHT;
	public void setDir(int dir){this.dir = dir;}
	public int getDir(){return dir;}

	public void setState(short i) {
		state = i;
	}

	//-dir
	public static final byte DIR_LEFT = 2;
	
	public static final byte DIR_RIGHT = 3;

	public static final byte DIR_UP = 0;

	public static final byte DIR_DOWN = 1;	


}

⌨️ 快捷键说明

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