diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-25 18:39:03 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-25 18:39:03 +0200 |
commit | eb40e3de7226d0005ce0a41c67c9355e675a489b (patch) | |
tree | 2ca2b4c14fcfa8c94370dfe0d192f82e41943b92 /src/model/Entity.hpp | |
parent | efa8640aabb3b4df31531ecd41ed1073dda63ed2 (diff) | |
download | rpgedit-eb40e3de7226d0005ce0a41c67c9355e675a489b.tar rpgedit-eb40e3de7226d0005ce0a41c67c9355e675a489b.zip |
Add collision layer to maps and prevent movement into blocked areas
Diffstat (limited to 'src/model/Entity.hpp')
-rw-r--r-- | src/model/Entity.hpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/model/Entity.hpp b/src/model/Entity.hpp index 1ff444a..170f23a 100644 --- a/src/model/Entity.hpp +++ b/src/model/Entity.hpp @@ -39,6 +39,8 @@ namespace RPGEdit { namespace Model { +class Map; + class Entity { private: const std::string name; @@ -97,29 +99,13 @@ public: return direction; } - void moveTo(Position newPos) { - pos = newPos; - transitionStart = transitionEnd = 0; - } - - void move(Direction dir, uint64_t start, uint64_t end) { - if (hasTransition()) - return; - - direction = dir; - - transitionStart = start; - transitionEnd = end; - } - - void finishTransition() { - if (hasTransition()) - moveTo(translate(direction, 1)); - } - bool hasTransition() const { return transitionEnd; } + + void moveTo(Map *map, Position newPos); + bool move(Map *map, Direction dir, uint64_t start, uint64_t end); + void finishTransition(Map *map); }; } |