📄 move.java
字号:
package mobileRPG.client.scriptaction;
import mobileRPG.client.Script;
import java.util.Random;
public class Move extends ScriptAction {
private boolean waitingForStop;
private int dirCode;
private Random random;
public Move(Script s, String d) {
super(s);
waitingForStop = false;
if (d.equals("r")) {
if (random == null) {
random = new Random();
}
dirCode = (random.nextInt());
dirCode = dirCode / (Integer.MAX_VALUE / 4);
//dirCode = (random.nextInt(4)+1) * -1;
//dirCode = (int)(Math.random() * 4.0);
//dirCode = -2;
} else if (d.equals("n")) {
dirCode = -1;
} else if (d.equals("s")) {
dirCode = -2;
} else if (d.equals("e")) {
dirCode = -4;
} else if (d.equals("w")) {
dirCode = -3;
}
}
public void onTime() {
if (!waitingForStop) {
script.entity.move(dirCode);
waitingForStop = true;
} else if (script.entity.isMoving()) {
} else {
// Entity has stopped
complete = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -