-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit.java
More file actions
43 lines (43 loc) · 936 Bytes
/
Unit.java
File metadata and controls
43 lines (43 loc) · 936 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
import java.awt.*;
/**
*
* @author Max Bernstein, Chris Hinstorff, Marco Valente
* Creates a Unit that has a color and an x and y coordinate
*/
public abstract class Unit {
protected static Color color;
protected static int xcoord, ycoord;
/**
* Sets the x coordinate of the Unit
* @param x the new x coordinate
*/
public void setX(int x) {
xcoord = x;
}
/**
* Sets the y coordinate of the Unit
* @param y the new y coordinate
*/
public void setY(int y) {
ycoord = y;
}
/**
* Returns the x coordinate of the Unit
* @return x coordinate
*/
public int getX() {
return xcoord;
}
/**
* Returns the y coordinate of the Unit
* @return y coordinate
*/
public int getY() {
return ycoord;
}
/**
* Paints the Unit. Unimplemented.
* @param g the Graphics object
*/
public abstract void paint(Graphics g);
}