diff options
Diffstat (limited to 'pacman-c++/bonuspoint.cpp')
| -rw-r--r-- | pacman-c++/bonuspoint.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/pacman-c++/bonuspoint.cpp b/pacman-c++/bonuspoint.cpp deleted file mode 100644 index 033b7c8..0000000 --- a/pacman-c++/bonuspoint.cpp +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | #include "bonuspoint.h" | ||
| 2 | #include "constants.h" | ||
| 3 | #include "actor.h" | ||
| 4 | |||
| 5 | #define BONUSPOINTS_NUM_SPRITES 4 | ||
| 6 | |||
| 7 | namespace | ||
| 8 | { | ||
| 9 | QPixmap *pixmap = NULL; | ||
| 10 | } | ||
| 11 | |||
| 12 | BonusPoint::BonusPoint(QGraphicsItem *parent) | ||
| 13 | : GameEntity(parent) | ||
| 14 | { | ||
| 15 | m_type = Type; | ||
| 16 | |||
| 17 | /* empty object for servers */ | ||
| 18 | if (Constants::server) | ||
| 19 | return; | ||
| 20 | |||
| 21 | if (pixmap == NULL) | ||
| 22 | pixmap = new QPixmap(":/bonuspoints"); | ||
| 23 | setPixmap(*pixmap); | ||
| 24 | |||
| 25 | int rand = (int) (BONUSPOINTS_NUM_SPRITES * (qrand() / (RAND_MAX + 1.0))); | ||
| 26 | setSprite(rand * 20 + Constants::sprite_margin, Constants::sprite_margin, Constants::field_size.width, Constants::field_size.height); | ||
| 27 | } | ||
| 28 | |||
| 29 | GameEntity::EnteredState BonusPoint::enter(Actor *actor) | ||
| 30 | { | ||
| 31 | actor->addRoundPoints(Constants::Game::bonus_point_value); | ||
| 32 | return DestroyedEntity; | ||
| 33 | } | ||
| 34 | |||
| 35 | void BonusPoint::onDie(Actor *actor) | ||
| 36 | { | ||
| 37 | actor->eatingFruit(); | ||
| 38 | } | ||
