forked from mcyapan/CSCI205Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDot.java
More file actions
33 lines (28 loc) · 1.03 KB
/
Dot.java
File metadata and controls
33 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.awt.*;
import java.awt.geom.*;
public class Dot extends DrawingObject {
// Constructor to initialize a dot (circle) at a given world position
public Dot(int worldX, int worldY) {
super(false);
this.setName("Dot");
this.setWorldX(worldX);
this.setWorldY(worldY);
this.setCollision(false);
this.setSolidAreaX(12);
this.setSolidAreaY(12);
this.setSolidAreaWidth(24);
this.setSolidAreaHeight(24);
// // Initialize shapes and colors arrays
// this.shapes = new ArrayList<>();
// this.colors = new ArrayList<>();
// Add shapes and colors for the Dot object
addShape(new Ellipse2D.Double(12, 12, 24, 24), Color.ORANGE);
addShape(new Ellipse2D.Double(15, 15, 18, 18), Color.YELLOW);
addShape(new Ellipse2D.Double(24, 18, 6, 6), Color.WHITE);
}
// Add shape and corresponding color
public void addShape(Shape shape, Color color) {
getShapes().add(shape);
getColors().add(color);
}
}