GrowUp::GrowUp(Direction direction)
: MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING)
{
GrowUp::GrowUp(Direction direction)
: MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING)
{
- physic.gravity_enabled = true;
- physic.vx = (direction == LEFT?-100:100);
- sound_manager->preload("sounds/grow.wav");
+ physic.enable_gravity(true);
+ physic.set_velocity_x((direction == LEFT)?-100:100);
+ sound_manager->preload("sounds/grow.ogg");
- if(!player->add_bonus(GROWUP_BONUS, true))
- return FORCE_MOVE;
+ if(!player->add_bonus(GROWUP_BONUS, true)){
+ // Tux can't grow right now.
+ collision_solid( hit );
+ return ABORT_MOVE;
+ }