From 7e4bc8ece49543533c4e27f5d6bc867c1bada601 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 9 Apr 2011 12:34:06 +0200 Subject: collision detection fix --- pacman-c++/actor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'pacman-c++/actor.cpp') 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) : PixmapItem(parent), m_color(color), m_direction(Actor::None), m_local(local) { m_pix = ":/" + QString("actor%1").arg((m_color >> 1) + 1); - /* DON'T set any pixmap here. we've a pixmap in the animation */ + /* DON'T set any pixmap here. we've a pixmap in the animation + * but we need a sprite for the collision detection + */ + setSprite(Constants::sprite_margin, Constants::sprite_margin, Constants::field_size.width, Constants::field_size.height); /* higher player "over" lower player */ setZValue(m_color * 10); @@ -165,7 +168,7 @@ void Actor::move(Actor::Movement direction) { if (m_local && AudioPlayer::self()->state() != Phonon::PlayingState) { - AudioPlayer::self()->clearQueue(); + AudioPlayer::self()->clear(); AudioPlayer::self()->play(AudioPlayer::WakaWaka); AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); } @@ -183,7 +186,7 @@ bool Actor::isMoving() } void Actor::enqueue() -{ +{ if (isMoving()) AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); } -- cgit v1.2.3