📄 map.java
字号:
package Kidfishing;
import java.io.IOException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import tool.Tools;
public class Map {
static final int ROW = 25;
int level = 1, goal;// 关数,目标
int mx, count;
Image i;// 地图
Image t;// 时间
Image num[] = new Image[60];
Map() {
try {
i = Image.createImage("/fondo4.png");
// ------------------------------------
t = Image.createImage("/time.png");
// -------------------------------------
Image res = Image.createImage("/timenum.png");
num = Tools.getAnmi(res, 0, 0, 6, 10, 18, 13);
} catch (IOException e) {
e.printStackTrace();
}
}
// 画地图
void drawMap(Graphics g) {
g.drawImage(i, mx, 0, Graphics.TOP | Graphics.LEFT);
g.drawImage(i, mx - 176, 0, Graphics.TOP | Graphics.LEFT);
drawWatch(g);
}
// 关卡
int tollgate() {
goal = 150 + (level) * 150 + (level / 2) * 200 + (level / 3) * 250;
return goal;
}
void moveMap() {
mx = mx - 2 < 0 ? mx = 176 : mx - 2;
}
// 画钟表
void drawWatch(Graphics g) {
g.drawImage(t, 0, 0, Graphics.TOP | Graphics.LEFT);
if (count % 50 >= 0 && count % 50 <= 49) {
int a = 59 - count / 50;
g.drawImage(num[a], 25, 0, Graphics.TOP | Graphics.LEFT);
}
}
// 控制计数器
int countUp(boolean a) {
if (a == true) {
count++;
if (count == 10000) {
count = 0;
}
} else {
count = 0;
}
return count;
}
public void circulateMap() {
if (count % 3 == 0) {
moveMap();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -