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

📄 pointitemtestmidlet.java

📁 一个简单的手机游戏例子。可以用来参考以下。
💻 JAVA
字号:
package redduke.game.j2me.example;

import redduke.game.j2me.GameMIDlet;
import redduke.game.j2me.ui.*;
import redduke.game.j2me.util.*;

/*
 * PointItem 测试
 */
public class PointItemTestMIDlet extends GameMIDlet {
	public PointItemTestMIDlet() {
		super(new PointItemTestCanvas());
	}

	static class PointItemTestCanvas extends GameCanvas {
		PointItem item = new PointItem(30, 30);
		{
			add(item);
			super.clearKeyState();
			super.setBackGround(Color.blue);
		}

		protected void main() {
			/*
			 * 向上移动
			 */
			if (super.isPressing(UP))
				item.move(0, -1, true);
			/*
			 * 向下移动
			 */
			if (super.isPressing(DOWN))
				item.move(0, 1, true);
			/*
			 * 向左移动
			 */
			if (super.isPressing(LEFT))
				item.move(-1, 0, true);
			/*
			 * 向右移动
			 */
			if (super.isPressing(RIGHT))
				item.move(1, 0, true);
			/*
			 * 随机改变颜色
			 */
			if (super.isPressing(FIRE))
				item.setColor(Util.randInt(0xffffff));
		}
	}
}

⌨️ 快捷键说明

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