⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stonesprite.java

📁 自己编的手机游戏
💻 JAVA
字号:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
public class stoneSprite extends Sprite{
private static int width=33;
private static int height=20;
private int disWidth;
private int disHeight;
private int nowX;
private int nowY;
private int position;
public stoneSprite(int dWidth,int dHeight,int pos)throws Exception{
super(Image.createImage("/stone.png"[img]/images/wink.gif[/img],width,height);
position=pos;
disWidth=dWidth;
disHeight=dHeight; 
}
public void reset(){
for(int i=1;i<=4;i++){
if(position==i){
nowX=(disWidth-getWidth())/2;
nowY=disHeight-60-(position-1)*40;
}
}
if(position==5){
nowX=(disWidth-getWidth())/2;
nowY=disHeight-40;
}
setPosition(nowX,nowY); 
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -