diff options
Diffstat (limited to 'src/ch/epfl')
-rw-r--r-- | src/ch/epfl/maze/physical/Animal.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ch/epfl/maze/physical/Animal.java b/src/ch/epfl/maze/physical/Animal.java index ebe389f..9123d82 100644 --- a/src/ch/epfl/maze/physical/Animal.java +++ b/src/ch/epfl/maze/physical/Animal.java | |||
@@ -6,10 +6,14 @@ import ch.epfl.maze.util.Vector2D; | |||
6 | /** | 6 | /** |
7 | * Animal inside a {@code World} that can move depending on the available | 7 | * Animal inside a {@code World} that can move depending on the available |
8 | * choices it has at its position. | 8 | * choices it has at its position. |
9 | * | ||
10 | * @author Pacien TRAN-GIRARD | ||
9 | */ | 11 | */ |
10 | 12 | ||
11 | abstract public class Animal { | 13 | abstract public class Animal { |
12 | 14 | ||
15 | private Vector2D position; | ||
16 | |||
13 | /** | 17 | /** |
14 | * Constructs an animal with a specified position. | 18 | * Constructs an animal with a specified position. |
15 | * | 19 | * |
@@ -17,7 +21,7 @@ abstract public class Animal { | |||
17 | */ | 21 | */ |
18 | 22 | ||
19 | public Animal(Vector2D position) { | 23 | public Animal(Vector2D position) { |
20 | // TODO | 24 | this.position = position; |
21 | } | 25 | } |
22 | 26 | ||
23 | /** | 27 | /** |
@@ -42,7 +46,7 @@ abstract public class Animal { | |||
42 | */ | 46 | */ |
43 | 47 | ||
44 | public final void update(Direction dir) { | 48 | public final void update(Direction dir) { |
45 | // TODO | 49 | this.position = this.position.addDirectionTo(dir); |
46 | } | 50 | } |
47 | 51 | ||
48 | /** | 52 | /** |
@@ -55,7 +59,7 @@ abstract public class Animal { | |||
55 | */ | 59 | */ |
56 | 60 | ||
57 | public final void setPosition(Vector2D position) { | 61 | public final void setPosition(Vector2D position) { |
58 | // TODO | 62 | this.position = position; |
59 | } | 63 | } |
60 | 64 | ||
61 | /** | 65 | /** |
@@ -65,8 +69,7 @@ abstract public class Animal { | |||
65 | */ | 69 | */ |
66 | 70 | ||
67 | public final Vector2D getPosition() { | 71 | public final Vector2D getPosition() { |
68 | // TODO | 72 | return this.position; |
69 | return null; | ||
70 | } | 73 | } |
71 | 74 | ||
72 | abstract public Animal copy(); | 75 | abstract public Animal copy(); |