X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Fbrick.cpp;h=36c6d6e90096efe15ffe6a1285108627a5e1379b;hb=d794aac09d4a3b3f5f93985cd74381bb4de4ce84;hp=8b85905488ed5ce86a87d99d40b1bd767ad15226;hpb=b4ffa23e2beb6d10f8f5f2fccd4b41fb3e344759;p=supertux.git diff --git a/src/object/brick.cpp b/src/object/brick.cpp index 8b8590548..36c6d6e90 100644 --- a/src/object/brick.cpp +++ b/src/object/brick.cpp @@ -1,5 +1,5 @@ // SuperTux -// Copyright (C) 2009 Ingo Ruhnke +// Copyright (C) 2009 Ingo Ruhnke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "object/bouncy_coin.hpp" #include "object/explosion.hpp" #include "object/flower.hpp" +#include "object/icecrusher.hpp" #include "object/player.hpp" #include "object/portable.hpp" #include "sprite/sprite_manager.hpp" @@ -28,7 +29,7 @@ #include "supertux/sector.hpp" Brick::Brick(const Vector& pos, int data, const std::string& spriteName) - : Block(sprite_manager->create(spriteName)), breakable(false), + : Block(SpriteManager::current()->create(spriteName)), breakable(false), coin_counter(0) { bbox.set_pos(pos); @@ -48,11 +49,12 @@ Brick::hit(Player& player) } HitResponse -Brick::collision(GameObject& other, const CollisionHit& hit){ +Brick::collision(GameObject& other, const CollisionHit& hit_){ Player* player = dynamic_cast (&other); if (player) { if (player->does_buttjump) try_break(player); + if (player->is_stone() && player->get_velocity().y >= 280) try_break(player); // stoneform breaks through bricks } BadGuy* badguy = dynamic_cast (&other); @@ -75,7 +77,10 @@ Brick::collision(GameObject& other, const CollisionHit& hit){ if(explosion && explosion->hurts()) { try_break(player); } - return Block::collision(other, hit); + IceCrusher* icecrusher = dynamic_cast (&other); + if(icecrusher && coin_counter == 0) + try_break(player); + return Block::collision(other, hit_); } void @@ -84,11 +89,11 @@ Brick::try_break(Player* player) if(sprite->get_action() == "empty") return; - sound_manager->play("sounds/brick.wav"); + SoundManager::current()->play("sounds/brick.wav"); Sector* sector = Sector::current(); Player& player_one = *(sector->player); - if(coin_counter > 0) { - sector->add_object(new BouncyCoin(get_pos(),true)); + if(coin_counter > 0 ){ + sector->add_object(std::make_shared(get_pos(), true)); coin_counter--; player_one.get_status()->add_coins(1); if(coin_counter == 0)