layer.java
来自「用J2ME实现的战棋类小游戏DEMO,寻路用A星算法,因为时间关系物品使用功能请」· Java 代码 · 共 71 行
JAVA
71 行
package midp20;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public abstract class Layer {
int tileIndex = 0;
int x = 0;
int y = 0;
int width;
int height;
int row=0;
int column=0;
int numTiles=0;
boolean visible = false;
Image resouce;
public Layer(Image img, int width, int height) {
this.width = width;
this.height = height;
resouce = img;
column=resouce.getWidth()/width;
row=resouce.getHeight()/height;
numTiles=column*row;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setPosition(int x,int y) {
this.x=x;
this.y=y;
}
public void move(int x, int y){
this.x+=x;
this.y+=y;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean b) {
visible=b;
}
public abstract void paint(Graphics g);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?