?? npc.java
字號:
package obj;
import main.*;
import javax.microedition.lcdui.game.*;
import javax.microedition.lcdui.*;
public class Npc extends Sprite{
private int direct=0;
private int xpos;
private int ypos;
private int s=MyControl.load.npcSpeed;//npc的移動速度
public boolean isSpeaking=false;
private static final int[] k = {0, 1, 2, 3, 4, 5, 6, 7};
public void turn(int d,int sx,int sy){
if(!isSpeaking){
if((direct==k.length>>1)||(direct==0)){s=-s;}
direct=(direct+d)%k.length;
this.setFrame(k[direct]);
xpos+=sx*s;
ypos+=sy*s;}
else{this.setFrame(0);}
this.setPosition(xpos,ypos);
}
public Npc(Image img,int width,int height,int x,int y) {
super(img,width,height);
xpos=x;
ypos=y;
this.setPosition(xpos,ypos);
}
public int getXpos() {
return xpos;
}
public int getYpos() {
return ypos;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -