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

📄 explosion.java

📁 java 写的飞行射击游戏。是游戏的基础。可以参考一下。对游戏开发有帮助。
💻 JAVA
字号:
package airplane;

import java.awt.Image;
import java.applet.Applet;
import java.awt.Graphics;

public class Explosion{
  private Applet Game;
  private Image[] explFrameImage;
  private int explNum = 0;  //爆炸图片的当前帧
  private int curX, curY;
  private boolean visible;

  public Explosion(Image[] explImages,Applet Game) {
    this.Game = Game;
    explFrameImage = explImages;
   // for(int i=0; i<explFrameImage.length ;i++){
   //   System.out.println(explFrameImage[i]);
   // }
    this.setVisible(false);
    curX = 0;
    curY = 0;
  }

  public void setVisible(boolean v) {
    visible = v;
  }

  public void updateState() { //更新爆炸的帧
    explNum = explNum +1;
    if(explNum >= explFrameImage.length -1){
      explNum = 0;
      this.setVisible(false);
    }
  }

  public void setLocation(int X, int Y) {
    curX = X;
    curY = Y;
  }

  public void paintSprite(Graphics g){

    if (visible == true) {
      //try{
        System.out.println(explNum);
        System.out.println("explFrameImage[explNum]:"+explFrameImage[explNum]);
        System.out.println("curX:"+curX+"  curY:"+curY);
        System.out.println(Game);
        System.out.println(g);
        g.drawImage(explFrameImage[explNum], curX, curY,34,33,Game);
      //}catch(Exception e){}
    }
  }



}

⌨️ 快捷键说明

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