X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FEntity.cpp;h=08be97b96c93208ab95774ed4168377e02cc007d;hb=d969efe468d2d9775ab2c5388be1cde8efa0b9ad;hp=302ce5c195ac856ab8aafaaae7befb0b5634b226;hpb=72988b5f9bd449cffea97273bebfc788735ce14d;p=l2e.git diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index 302ce5c..08be97b 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -12,10 +12,11 @@ using geometry::Vector; namespace map { Entity::Entity() -: animation(0) +: follower(0) +, animation(0) , orientation(ORIENTATION_NORTH) , speed(0) { - + runner.SetFrameShift(1); } @@ -30,6 +31,34 @@ void Entity::SetSpeed(float s) { UpdateVelocity(); } +void Entity::StartAnimation(app::Application &ctrl) { + runner.Start(ctrl); +} + +void Entity::StartAnimation(app::State &ctrl) { + runner.Start(ctrl); +} + +void Entity::StopAnimation() { + runner.Stop(); +} + +void Entity::AddFollower(Entity *f) { + if (follower) { + follower->AddFollower(f); + } else { + follower = f; + } +} + +void Entity::RemoveFollower(Entity *f) { + if (follower == f) { + follower = follower->follower; + } else if (follower) { + follower->RemoveFollower(f); + } +} + void Entity::SetAnimation(const graphics::Animation *a) { animation = a; runner.ChangeAnimation(animation);