?? spritemanager.java~2~
字號:
package WealthGod130;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
public class SpriteManager extends LayerManager implements Runnable{
protected Graphics g;
protected Sprites sp;
protected Sprites sp1;
protected Sprites sp2;
Thread t;
public SpriteManager(Graphics g) {
this.g = g;
sp = null;
sp1 = null;
sp2 = null;
t = new Thread(this);
t.start();
}
public void run()
{
while(true)
{
for(int i=0;i<this.getSize();i++)
{
sp = (Sprites) this.getLayerAt(i);
sp.nextFrame();
if(sp != null)
{
if(sp.Draw() == 1){
this.remove(sp);
sp = null;
}
else
{
if(sp.SPRITE_TYPE == 1)
sp1 = sp;
if(sp.SPRITE_TYPE == 2)
sp2 = sp;
if(sp1 != null && sp2 != null){
if (Math.abs(sp1.x - sp2.x) < 40 && Math.abs(sp1.y - sp2.y) < 40) {
this.remove(sp2);
}
}
}
}
}
try {
Thread.sleep(20);
}
catch (InterruptedException ex) {}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -