📄 boom2.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 + -