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

📄 spritemanager.java~4~

📁 基于数字机顶盒J2me平台开发的互动游戏《金鼠财神》游戏
💻 JAVA~4~
字号:
package WealthGod104;

import javax.microedition.lcdui.game.*;
import java.lang.Math.*;

public class SpriteManager extends LayerManager implements Runnable{
  protected Sprites sp;
  protected Sprites sp1;
  protected Sprites sp2;
  public SpriteManager() {
    sp = null;
    sp1 = null;
    sp2 = null;
  }

  public void run()
  {
    while(true)
    {
      for(int i=0;i<this.getSize();i++)
      {
        sp = (Sprites) this.getLayerAt(i);
        if(sp != null)
        {
          if(sp.ChangPos() == 1){
            this.remove(sp);
            sp = null;
          }
          if(sp.SPRITE_TYPE == 1)
            sp1 = sp;
          if(sp.SPRITE_TYPE == 2)
            sp2 = sp;
          if(Math.abs(sp1.x - sp2.x)<40 && Math.abs(sp1.y - sp2.y)<40){

            this.remove(sp2);
          }
        }
      }
    }
  }
}

⌨️ 快捷键说明

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