18 lines
342 B
Java
18 lines
342 B
Java
package game;
|
|
|
|
import java.awt.*;
|
|
|
|
public enum Direction {
|
|
UP(new Point(0,-1)),
|
|
DOWN(new Point(0,1)),
|
|
LEFT(new Point(-1,0)),
|
|
RIGHT(new Point(1,0));
|
|
private Point offset;
|
|
Direction(Point offset) {
|
|
this.offset = offset;
|
|
}
|
|
public static Point getOffset(Direction dir) {
|
|
return dir.offset;
|
|
}
|
|
}
|