X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.h;h=12f22c947aae0c903a2468382c0261217ae76456;hb=0fc36d261ef8129debbd4aa15594bc46cb82eb27;hp=fd91f3eeb5ce2114a578ba6b9ffdfb61da02a774;hpb=c03b01f2a152927227a674d462794604aa08e5dd;p=l2e.git diff --git a/src/map/Entity.h b/src/map/Entity.h index fd91f3e..12f22c9 100644 --- a/src/map/Entity.h +++ b/src/map/Entity.h @@ -23,6 +23,14 @@ public: Entity(); ~Entity() { } +public: + enum Orientation { + ORIENTATION_NORTH = 0, + ORIENTATION_EAST = 1, + ORIENTATION_SOUTH = 2, + ORIENTATION_WEST = 3, + }; + public: geometry::Vector &Position() { return position; } const geometry::Vector &Position() const { return position; } @@ -30,19 +38,42 @@ public: geometry::Vector &Velocity() { return velocity; } const geometry::Vector &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 &SpriteOffset() { return spriteOffset; } + const geometry::Vector &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); + + Entity *Follower() { return follower; } + const Entity *Follower() const { return follower; } + void AddFollower(Entity *); + void RemoveFollower(Entity *); + + bool TileLock(const geometry::Vector &tileSize) const; void Update(float deltaT); void Render(SDL_Surface *, const geometry::Vector &offset) const; private: - const graphics::Sprite *sprite; - graphics::AnimationRunner animation; + void UpdateVelocity(); + +private: + Entity *follower; + const graphics::Animation *animation; + graphics::AnimationRunner runner; + geometry::Vector spriteOffset; geometry::Vector position; geometry::Vector velocity; + Orientation orientation; + float speed; };