📄 npcsprite.java
字号:
import javax.microedition.lcdui.Image;
/*
* 创建日期 2005-10-6
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
/**
* @author Administrator
* Download by http://www.codefans.net
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class NPCSprite extends ASprite {
/**
* @param arg0
* @param arg1
* @param arg2
*/
public int normal[]={0,1};
public int x,y,heroDis;
int type,stoptime=10,temptime=0;
public NPCSprite(Image arg0, int arg1, int arg2,int type,int x,int y) {
super(arg0, arg1, arg2);
this.type=type;
dx=x;//-this.getWidth();
dy=y;//-this.getHeight();
this.x=x;
this.y=y;
this.type=type;
this.setFrameSequence(normal);
//this.setPosition(dx,dy);
// TODO 自动生成构造函数存根
}
public boolean isTalkable(int heroX,int heroY){
heroDis=(int)((heroX-x)*(heroX-x)+(heroY-y)*(heroY-y));
if(temptime<stoptime){
temptime++;
}else{
temptime=0;
this.nextFrame();
}
if(heroDis<900){
return true;
}else return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -