]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Entity.h
implemented followers
[l2e.git] / src / map / Entity.h
index e1ede977e65888eea33360f20a37b3f91aa63a93..12f22c947aae0c903a2468382c0261217ae76456 100644 (file)
@@ -38,15 +38,25 @@ public:
        geometry::Vector<float> &Velocity() { return velocity; }
        const geometry::Vector<float> &Velocity() const { return velocity; }
 
-       void SetSprite(const graphics::Sprite *s) { sprite = s; }
-       graphics::AnimationRunner &Animation() { return animation; }
-       const graphics::AnimationRunner &Animation() const { return animation; }
+       geometry::Vector<float> &SpriteOffset() { return spriteOffset; }
+       const geometry::Vector<float> &SpriteOffset() const { return spriteOffset; }
+
+       void SetAnimation(const graphics::Animation *a);
+       void StartAnimation(app::Application &ctrl);
+       void StartAnimation(app::State &ctrl);
+       void StopAnimation();
+       bool AnimationRunning() const { return runner.Running(); }
 
        void SetOrientation(Orientation);
        Orientation GetOrientation() const { return orientation; }
        void SetSpeed(float);
 
-       bool TileLock(int width, int height) const;
+       Entity *Follower() { return follower; }
+       const Entity *Follower() const { return follower; }
+       void AddFollower(Entity *);
+       void RemoveFollower(Entity *);
+
+       bool TileLock(const geometry::Vector<int> &tileSize) const;
 
        void Update(float deltaT);
 
@@ -56,8 +66,10 @@ private:
        void UpdateVelocity();
 
 private:
-       const graphics::Sprite *sprite;
-       graphics::AnimationRunner animation;
+       Entity *follower;
+       const graphics::Animation *animation;
+       graphics::AnimationRunner runner;
+       geometry::Vector<float> spriteOffset;
        geometry::Vector<float> position;
        geometry::Vector<float> velocity;
        Orientation orientation;