summaryrefslogtreecommitdiffstats
path: root/src/model/Entity.hpp
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-23 00:13:05 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-23 00:13:05 +0200
commit11e77a9d65972c8e59aefd72419dfcf9036e9f6a (patch)
tree03288809e9a592849e881d6f3baae2eb41bee5cb /src/model/Entity.hpp
parentc9b41bc1022c75ac6da84f4fa503dd8231a96cf2 (diff)
downloadrpgedit-11e77a9d65972c8e59aefd72419dfcf9036e9f6a.tar
rpgedit-11e77a9d65972c8e59aefd72419dfcf9036e9f6a.zip
Allow player movement
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;
+ }
+ }
};
}