📄 sprite.java
字号:
package pinball;import javax.microedition.lcdui.Graphics;public class Sprite { public int x; public int y; public int width; public int height; public int shadow; public Sprite() { shadow = Math.max(2, Screen.width / 60); } public int getCenterX() { return x + width / 2; } public int getCenterY() { return y + height / 2; } public void moveTo(int x, int y) { this.x = x; this.y = y; } public void moveBy(int x, int y) { this.x += x; this.y += y; } public void paint(Graphics g) {} public void paintShadow(Graphics g) {} public boolean intersects(Sprite other) { int xw = x + width; int yh = y + height; int oxw = other.x + other.width; int oyh = other.y + other.height; return x >= other.x && x < oxw && y >= other.y && y < oyh || xw >= other.x && xw < oxw && y >= other.y && y < oyh || x >= other.x && x < oxw && yh >= other.y && yh < oyh || xw >= other.x && xw < oxw && yh >= other.y && yh < oyh; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -