📄 npc.java
字号:
package rpg_demo_P;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
public class Npc extends Sprite
{
public int x;
public int y;
public int w_Frame,h_Frame;
public String name;
public Npc(Image img,int w_Frame,int h_Frame,int x,int y,String name)
{
super(img,w_Frame,h_Frame);
this.w_Frame=w_Frame;
this.h_Frame=h_Frame;
this.x=x;
this.y=y;
this.name=name;
this.setPosition(this.x,this.y);
}
public void DrawState(Graphics g,String s,int npc_x,int npc_y)
{
g.setColor(0x480048);
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM));
g.drawString(s,npc_x+10,npc_y-10,Graphics.TOP|Graphics.LEFT);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -