gametools.java

来自「用J2ME实现的战棋类小游戏DEMO,寻路用A星算法,因为时间关系物品使用功能请」· Java 代码 · 共 40 行

JAVA
40
字号
package midp20;

import java.io.IOException;

import javax.microedition.lcdui.Image;

public class GameTools {
	public static int cx=0,cy=0;
	public static int mWidth=16,mHeight=16;
	public static int state=0;
    public static int currentTalk=0;
	public static int currentAction=0;
	public static int SCREEN_WIDTH, SCREEN_HEIGHT;
	public static Image createImg(String path) {
		Image img = null;
		try {
			img = Image.createImage(path);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return img;
	}

	public static boolean collidesRects(int x1, int y1, int w1, int h1, int x2,
			int y2, int w2, int h2) {

		if (x1 > x2 + w2)
			return false;
		if (x1 + w1 < x2)
			return false;
		if (y1 > y2 + h2)
			return false;
		if (y1 + h1 < y2)
			return false;
		return true;
	}

}

⌨️ 快捷键说明

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