diff options
| author | manuel <manuel@mausz.at> | 2011-04-04 14:40:13 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-04 14:40:13 +0200 |
| commit | 471177aad38350840eed6452b1ad8723b61c330d (patch) | |
| tree | 02f568f52cfe3ecd4c48fe9a96086ac3f748cd59 /pacman-c++/actor.cpp | |
| parent | 03c82aa4ebb40b7c6ba5a304df6ff11b85afe80d (diff) | |
| download | foop-471177aad38350840eed6452b1ad8723b61c330d.tar.gz foop-471177aad38350840eed6452b1ad8723b61c330d.tar.bz2 foop-471177aad38350840eed6452b1ad8723b61c330d.zip | |
add more pacmans
Diffstat (limited to 'pacman-c++/actor.cpp')
| -rw-r--r-- | pacman-c++/actor.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index e98545b..4704ed1 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -18,9 +18,10 @@ static QVariant myBooleanInterpolator(const bool &start, const bool &end, qreal | |||
| 18 | Actor::Actor(Type type) | 18 | Actor::Actor(Type type) |
| 19 | : m_type(type), m_direction(Actor::None) | 19 | : m_type(type), m_direction(Actor::None) |
| 20 | { | 20 | { |
| 21 | m_pix = ":/" + QString("actor%1").arg(type); | 21 | m_pix = ":/" + QString("actor%1").arg(m_type); |
| 22 | setPixmap(m_pix); | ||
| 23 | setSprite(82, 82, SPRITE_PLAYER_WIDTH, SPRITE_PLAYER_HEIGHT); | 22 | setSprite(82, 82, SPRITE_PLAYER_WIDTH, SPRITE_PLAYER_HEIGHT); |
| 23 | // higher player "over" lower player | ||
| 24 | setZValue(m_type * 10); | ||
| 24 | 25 | ||
| 25 | m_direction = Actor::Left; | 26 | m_direction = Actor::Left; |
| 26 | 27 | ||
| @@ -36,6 +37,7 @@ Actor::Actor(Type type) | |||
| 36 | int x = i * 20 + SPRITE_MARGIN; | 37 | int x = i * 20 + SPRITE_MARGIN; |
| 37 | int y = m_direction * 20 + SPRITE_MARGIN; | 38 | int y = m_direction * 20 + SPRITE_MARGIN; |
| 38 | img->setSprite(x, y, SPRITE_PLAYER_WIDTH, SPRITE_PLAYER_HEIGHT); | 39 | img->setSprite(x, y, SPRITE_PLAYER_WIDTH, SPRITE_PLAYER_HEIGHT); |
| 40 | img->setZValue(zValue()); | ||
| 39 | img->setVisible(false); | 41 | img->setVisible(false); |
| 40 | img->setPos(QPointF(200, 0)); | 42 | img->setPos(QPointF(200, 0)); |
| 41 | 43 | ||
| @@ -50,7 +52,7 @@ Actor::Actor(Type type) | |||
| 50 | fadeout->setEndValue(false); | 52 | fadeout->setEndValue(false); |
| 51 | 53 | ||
| 52 | QPropertyAnimation *move = new QPropertyAnimation(img, "pos", moving); | 54 | QPropertyAnimation *move = new QPropertyAnimation(img, "pos", moving); |
| 53 | move->setDuration(10000); | 55 | move->setDuration(5000); |
| 54 | move->setEndValue(QPointF(0, 0)); | 56 | move->setEndValue(QPointF(0, 0)); |
| 55 | } | 57 | } |
| 56 | 58 | ||
