-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapObject.java
More file actions
49 lines (39 loc) · 908 Bytes
/
Copy pathMapObject.java
File metadata and controls
49 lines (39 loc) · 908 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.awt.Rectangle;
import java.awt.Color;
public abstract class MapObject {
protected Point pos; // position on map
protected Point dir; // x and y values can be -1, 0, or 1. used for movement only
protected int size; // size in pixels
protected Color color;
// Collisions
protected Rectangle hitBox;
// Constructor
MapObject(Point pos, Point dir, int size, Color color) {
this.pos = pos;
this.dir = dir;
this.size = size;
this.color = color;
}
public Point getPos() {
return pos;
}
public void setPos(Point pos) {
this.pos.x = pos.x;
this.pos.y = pos.y;
}
public int getSize() {
return size;
}
public Point getDir() {
return dir;
}
public Color getColor() {
return color;
}
public Rectangle getHitBox() {
return hitBox;
}
public void setHitBox(Rectangle hitBox) {
this.hitBox = hitBox;
}
}