第十一次实验课代码
添加C08~C011
This commit is contained in:
17
C09-Collection/src/game/Direction.java
Normal file
17
C09-Collection/src/game/Direction.java
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user