formatting

This commit is contained in:
2026-04-19 14:41:10 -05:00
parent 9f790813bb
commit a803f5e759
31 changed files with 793 additions and 795 deletions

View File

@@ -1,30 +1,30 @@
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.ImageIcon;
import java.awt.Graphics;
public class Collidable extends Sprite{
int x,y,width,height;
Rectangle rect;
public Collidable(int x1, int y1, int w, int h, ImageIcon icon){
super(icon);
x = x1;
y = y1;
width = w;
height = h;
rect = new Rectangle(x1,y1,w,h);
}
public void draw(Graphics g){
sprite = icon.getImage();
g.drawImage(sprite, x, y, width, height, null);
}
public boolean collidesWith(Collidable other) {
return this.rect.intersects(other.rect);
}
public void onCollide(Collidable other){
return;
}
}
public class Collidable extends Sprite {
int x, y, width, height;
Rectangle rect;
public Collidable(int x1, int y1, int w, int h, ImageIcon icon) {
super(icon);
x = x1;
y = y1;
width = w;
height = h;
rect = new Rectangle(x1, y1, w, h);
}
public void draw(Graphics g) {
sprite = icon.getImage();
g.drawImage(sprite, x, y, width, height, null);
}
public boolean collidesWith(Collidable other) {
return this.rect.intersects(other.rect);
}
public void onCollide(Collidable other) {
return;
}
}