summaryrefslogtreecommitdiffstats
path: root/src/model/Entity.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/Entity.hpp')
-rw-r--r--src/model/Entity.hpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/model/Entity.hpp b/src/model/Entity.hpp
index 518ce5f..a61ae21 100644
--- a/src/model/Entity.hpp
+++ b/src/model/Entity.hpp
@@ -63,10 +63,31 @@ public:
return dir;
}
- void move(float newX, float newY) {
+ void moveTo(float newX, float newY) {
x = newX;
y = newY;
}
+
+ void move(Direction direction, float amount = 1) {
+ dir = direction;
+
+ switch (direction) {
+ case NORTH:
+ y -= amount;
+ break;
+
+ case EAST:
+ x += amount;
+ break;
+
+ case SOUTH:
+ y += amount;
+ break;
+
+ case WEST:
+ x -= amount;
+ }
+ }
};
}