fix animation for good this time
[exterlulz-musk.git] / src / musk / actor.cpp
blobb3058e578daa38fd023f4cffabbd43ff4d2246c7
1 #include "actor.h"
3 namespace musk {
5 Actor::Actor(const Animation& animation) :
6 Animation(animation),
7 isMoving_(true),
8 movingDirection_(kDirectionRight),
9 // TODO: change back speed_ and destination_ as (0, 0)
10 speed_(1, 1),
11 destination_(120, 120) {
14 void Actor::move()
16 if (!shouldMove()) {
17 return;
20 setPosition(x() + speed_.first, y() + speed_.second);
23 bool Actor::shouldMove() const
25 if (!isMoving_) {
26 return false;
29 if (x() == destination_.first &&
30 y() == destination_.second) {
31 return false;
34 return true;