Poweruplover achievement

This commit is contained in:
sudip1401
2014-03-18 01:39:50 +05:30
parent ce12ebe9ce
commit 89d7663112
3 changed files with 17 additions and 5 deletions

View File

@@ -29,5 +29,9 @@
title="Skid-row" description="Make 5 skidding in a single race">
<skidding goal="5"/>
</achievement>
<achievement id="6" check-type="all-at-least" reset-after-race="yes"
title="Powerup Love" description="Use 10 or more powerups in a race">
<poweruplover goal="10"/>
</achievement>
</achievements>

View File

@@ -33,7 +33,7 @@
class Achievement;
/** This is the base class for storing the definition of an achievement, e.g.
/** This is the base class for storing the definition of an achievement, e.g.
* title, description (which is common for all achievements), but also how
* to achieve this achievement.
* \ingroup achievements
@@ -47,13 +47,14 @@ public:
ACHIEVE_STRIKE = 2,
ACHIEVE_ARCH_ENEMY = 3,
ACHIEVE_MARATHONER = 4,
ACHIEVE_SKIDDING = 5
ACHIEVE_SKIDDING = 5,
ACHIEVE_POWERUP_LOVER = 6
};
/** Achievement check type:
/** Achievement check type:
* ALL_AT_LEAST: All goal values must be reached (or exceeded).
* ONE_AT_LEAST: At least one current value reaches or exceedes the goal.
*/
enum AchievementCheckType
enum AchievementCheckType
{
AC_ALL_AT_LEAST,
AC_ONE_AT_LEAST

View File

@@ -18,6 +18,9 @@
#include "items/powerup.hpp"
#include "achievements/achievement_info.hpp"
#include "config/player_manager.hpp"
#include "audio/sfx_base.hpp"
#include "audio/sfx_manager.hpp"
#include "config/stk_config.hpp"
@@ -170,6 +173,10 @@ void Powerup::adjustSound()
*/
void Powerup::use()
{
// The player gets an achievement point for using a powerup
if (m_type != PowerupManager::POWERUP_NOTHING && m_owner->getController()->isPlayerController())
PlayerManager::increaseAchievement(AchievementInfo::ACHIEVE_POWERUP_LOVER, "poweruplover");
// Play custom kart sound when collectible is used //TODO: what about the bubble gum?
if (m_type != PowerupManager::POWERUP_NOTHING &&
m_type != PowerupManager::POWERUP_SWATTER &&
@@ -237,7 +244,7 @@ void Powerup::use()
m_sound_use->play();
pos.setY(hit_point.getY()-0.05f);
ItemManager::get()->newItem(Item::ITEM_BUBBLEGUM, pos, normal, m_owner);
}
else // if the kart is looking forward, use the bubblegum as a shield