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

📄 bullet.java

📁 小蜜蜂打飞机的游戏 很老的游戏了
💻 JAVA
字号:
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public class Bullet extends Sprite
{ 
  
  protected static final int RAW_FRAMES=1;
  protected int xPos;
  protected int yPos;  
  private static VaderManager layerManager;
  private static VaderCanvas gameCanvas;

  public Bullet(Image image, int width, int height, int xPos, int yPos)
  {
    super (image,width,height);
    this.yPos=yPos;
    this.xPos=xPos;
    gameCanvas=layerManager.getGameCanvas();
    setPosition(xPos, yPos);
  }
  
  public static void setLayerManager(VaderManager manager)		{layerManager=manager;}
  public void setY(int y)										{this.setPosition(this.getX(), this.getY()+y);}

  private void up()
  {
    move(0,-5);    
    if(this.getY()<0)
    {
    	layerManager.removeLayer(this);
    }  
  }
    
  public void tick()
  {
  	up();
  }

}

⌨️ 快捷键说明

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