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

📄 boom2.java

📁 一个不错的学习游戏,很适合初学者! 希望大家喜欢!
💻 JAVA
字号:
package qian;

import javax.microedition.lcdui.*;
import java.util.*;

public class Boom2 {
  static Image img;
  int x;
  int y;
  Graphics b;


  static {
    try {

      img = Image.createImage("/res/23.png");

    }
    catch (Exception e) {
    }

  }

  public Boom2(int xx,int yy) {
   this.x=xx;
   this.y=yy;
  }

  public void paint(Graphics g) {
    g.drawImage(img, x, y, Graphics.TOP | Graphics.LEFT);
  }

  public boolean crash(Ship ship) {

    if ( (this.x + this.img.getWidth()) > ship.x &&
        (this.x + this.img.getWidth()) < (ship.x + ship.imgLeft.getWidth()) &&
        (this.y) > ship.y&&
        (this.y) < (ship.y + ship.imgLeft.getHeight())) {
      return true;
    }

    if ( (this.x) > ship.x &&
        (this.x) < (ship.x + ship.imgLeft.getWidth()) &&
        (this.y) > ship.y &&
        (this.y) < (ship.y + ship.imgLeft.getHeight())) {
      return true;
    }

    return false;

  }

}

⌨️ 快捷键说明

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