diff options
| author | manuel <manuel@mausz.at> | 2011-05-02 19:14:55 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-05-02 19:14:55 +0200 |
| commit | 6ca702032d6844e211c67f18cf066e34fbbaf9d0 (patch) | |
| tree | 1db663110ea677a49fa18f8712ae66c99aff86e5 | |
| parent | 9e9aab951df61e5a8ca6b94bb764e956643685f4 (diff) | |
| download | foop-6ca702032d6844e211c67f18cf066e34fbbaf9d0.tar.gz foop-6ca702032d6844e211c67f18cf066e34fbbaf9d0.tar.bz2 foop-6ca702032d6844e211c67f18cf066e34fbbaf9d0.zip | |
fix animation zValue
| -rw-r--r-- | pacman-c++/actor.cpp | 6 | ||||
| -rw-r--r-- | pacman-c++/server.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 472b05d..757003e 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -44,7 +44,6 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 44 | int x = i * Constants::sprite_offset + Constants::sprite_margin; | 44 | int x = i * Constants::sprite_offset + Constants::sprite_margin; |
| 45 | int y = Actor::None * Constants::sprite_offset + Constants::sprite_margin; | 45 | int y = Actor::None * Constants::sprite_offset + Constants::sprite_margin; |
| 46 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); | 46 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); |
| 47 | img->setZValue(zValue()); | ||
| 48 | img->setVisible(false); | 47 | img->setVisible(false); |
| 49 | } | 48 | } |
| 50 | 49 | ||
| @@ -58,6 +57,7 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 58 | m_eating.append(setupEatingAnimation(Actor::Down)); | 57 | m_eating.append(setupEatingAnimation(Actor::Down)); |
| 59 | 58 | ||
| 60 | /* dieing animation */ | 59 | /* dieing animation */ |
| 60 | qWarning() << "color=" << Util::colorToString(m_color) << "zValue=" << zValue() << "dieing.z=" << 100 - m_color; | ||
| 61 | m_dieing = new QSequentialAnimationGroup(this); | 61 | m_dieing = new QSequentialAnimationGroup(this); |
| 62 | for (int i = 0; i < 11; i++) | 62 | for (int i = 0; i < 11; i++) |
| 63 | { | 63 | { |
| @@ -66,7 +66,6 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 66 | int x = i * Constants::sprite_offset + Constants::sprite_margin; | 66 | int x = i * Constants::sprite_offset + Constants::sprite_margin; |
| 67 | int y = 5 * Constants::sprite_offset + Constants::sprite_margin; | 67 | int y = 5 * Constants::sprite_offset + Constants::sprite_margin; |
| 68 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); | 68 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); |
| 69 | img->setZValue(zValue() * 10); | ||
| 70 | img->setVisible(false); | 69 | img->setVisible(false); |
| 71 | 70 | ||
| 72 | QPropertyAnimation *fadein = new QPropertyAnimation(img, "visible", m_dieing); | 71 | QPropertyAnimation *fadein = new QPropertyAnimation(img, "visible", m_dieing); |
| @@ -99,7 +98,6 @@ QSequentialAnimationGroup *Actor::setupEatingAnimation(Actor::Movement direction | |||
| 99 | int x = i * Constants::sprite_offset + Constants::sprite_margin; | 98 | int x = i * Constants::sprite_offset + Constants::sprite_margin; |
| 100 | int y = direction * Constants::sprite_offset + Constants::sprite_margin; | 99 | int y = direction * Constants::sprite_offset + Constants::sprite_margin; |
| 101 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); | 100 | img->setSprite(x, y, Constants::field_size.width, Constants::field_size.height); |
| 102 | img->setZValue(zValue()); | ||
| 103 | img->setVisible(false); | 101 | img->setVisible(false); |
| 104 | 102 | ||
| 105 | QPropertyAnimation *fadein = new QPropertyAnimation(img, "visible", eating); | 103 | QPropertyAnimation *fadein = new QPropertyAnimation(img, "visible", eating); |
| @@ -160,6 +158,7 @@ void Actor::reset() | |||
| 160 | 158 | ||
| 161 | stopEating(); | 159 | stopEating(); |
| 162 | m_moving->stop(); | 160 | m_moving->stop(); |
| 161 | setZValue(m_color * 10); | ||
| 163 | m_dieing->stop(); | 162 | m_dieing->stop(); |
| 164 | /* hide all pictures */ | 163 | /* hide all pictures */ |
| 165 | for (int i = 0; i < m_images.size(); ++i) | 164 | for (int i = 0; i < m_images.size(); ++i) |
| @@ -290,6 +289,7 @@ void Actor::die() | |||
| 290 | 289 | ||
| 291 | reset(); | 290 | reset(); |
| 292 | m_images[m_direction]->setVisible(false); | 291 | m_images[m_direction]->setVisible(false); |
| 292 | setZValue(zValue() * 10); | ||
| 293 | m_dieing->start(); | 293 | m_dieing->start(); |
| 294 | if (m_local) | 294 | if (m_local) |
| 295 | AudioManager::self()->play(Sound::Die); | 295 | AudioManager::self()->play(Sound::Die); |
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index a7ff89a..caf2fa5 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -254,7 +254,7 @@ invalid_direction: | |||
| 254 | } | 254 | } |
| 255 | } | 255 | } |
| 256 | if (found.count() > 1) | 256 | if (found.count() > 1) |
| 257 | qCritical() << "[Collision] found" << found << "fields with color=" << col; | 257 | qCritical() << "[Collision] found" << found.count() << "fields with color=" << col; |
| 258 | } | 258 | } |
| 259 | #endif | 259 | #endif |
| 260 | 260 | ||
