diff options
| author | manuel <manuel@mausz.at> | 2011-04-09 12:34:06 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-09 12:34:06 +0200 |
| commit | 7e4bc8ece49543533c4e27f5d6bc867c1bada601 (patch) | |
| tree | 261881edeed4c703c9f1fce5111705a013df8bdc /pacman-c++/actor.cpp | |
| parent | a4fc700dfe22c252824ac81711da4bd0bf94def5 (diff) | |
| download | foop-7e4bc8ece49543533c4e27f5d6bc867c1bada601.tar.gz foop-7e4bc8ece49543533c4e27f5d6bc867c1bada601.tar.bz2 foop-7e4bc8ece49543533c4e27f5d6bc867c1bada601.zip | |
collision detection fix
Diffstat (limited to 'pacman-c++/actor.cpp')
| -rw-r--r-- | pacman-c++/actor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 5ccc339..445d63d 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -14,7 +14,10 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 14 | : PixmapItem(parent), m_color(color), m_direction(Actor::None), m_local(local) | 14 | : PixmapItem(parent), m_color(color), m_direction(Actor::None), m_local(local) |
| 15 | { | 15 | { |
| 16 | m_pix = ":/" + QString("actor%1").arg((m_color >> 1) + 1); | 16 | m_pix = ":/" + QString("actor%1").arg((m_color >> 1) + 1); |
| 17 | /* DON'T set any pixmap here. we've a pixmap in the animation */ | 17 | /* DON'T set any pixmap here. we've a pixmap in the animation |
| 18 | * but we need a sprite for the collision detection | ||
| 19 | */ | ||
| 20 | setSprite(Constants::sprite_margin, Constants::sprite_margin, Constants::field_size.width, Constants::field_size.height); | ||
| 18 | /* higher player "over" lower player */ | 21 | /* higher player "over" lower player */ |
| 19 | setZValue(m_color * 10); | 22 | setZValue(m_color * 10); |
| 20 | 23 | ||
| @@ -165,7 +168,7 @@ void Actor::move(Actor::Movement direction) | |||
| 165 | { | 168 | { |
| 166 | if (m_local && AudioPlayer::self()->state() != Phonon::PlayingState) | 169 | if (m_local && AudioPlayer::self()->state() != Phonon::PlayingState) |
| 167 | { | 170 | { |
| 168 | AudioPlayer::self()->clearQueue(); | 171 | AudioPlayer::self()->clear(); |
| 169 | AudioPlayer::self()->play(AudioPlayer::WakaWaka); | 172 | AudioPlayer::self()->play(AudioPlayer::WakaWaka); |
| 170 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); | 173 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); |
| 171 | } | 174 | } |
| @@ -183,7 +186,7 @@ bool Actor::isMoving() | |||
| 183 | } | 186 | } |
| 184 | 187 | ||
| 185 | void Actor::enqueue() | 188 | void Actor::enqueue() |
| 186 | { | 189 | { |
| 187 | if (isMoving()) | 190 | if (isMoving()) |
| 188 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); | 191 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); |
| 189 | } | 192 | } |
