| 1 | // SuperTux BadGuy GoldBomb - a bomb that throws up coins when exploding |
| 2 | // Copyright (C) 2006 Matthias Braun <matze@braunis.de> |
| 3 | // Copyright (C) 2013 LMH <lmh.0013@gmail.com> |
| 4 | // |
| 5 | // This program is free software: you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License as published by |
| 7 | // the Free Software Foundation, either version 3 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | |
| 19 | #ifndef HEADER_SUPERTUX_BADGUY_GOLDBOMB_HPP |
| 20 | #define |
| 21 | |
| 22 | #include "badguy/walking_badguy.hpp" |
| 23 | #include "object/portable.hpp" |
| 24 | |
| 25 | class SoundSource; |
| 26 | |
| 27 | class GoldBomb final : public WalkingBadguy, public Portable |
| 28 | { |
| 29 | public: |
| 30 | GoldBomb(const ReaderMapping& reader); |
| 31 | |
| 32 | virtual void collision_solid(const CollisionHit& hit) override; |
| 33 | virtual HitResponse collision(GameObject& object, const CollisionHit& hit) override; |
| 34 | virtual HitResponse collision_player(Player& player, const CollisionHit& hit) override; |
| 35 | virtual HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit) override; |
| 36 | |
| 37 | virtual void active_update(float dt_sec) override; |
| 38 | |
| 39 | virtual void grab(MovingObject& object, const Vector& pos, Direction dir) override; |
| 40 | virtual void ungrab(MovingObject& object, Direction dir) override; |
| 41 | virtual bool is_portable() const override; |
| 42 | |
| 43 | virtual void freeze() override; |
| 44 | virtual bool is_freezable() const override; |
| 45 | |
| 46 | virtual void kill_fall() override; |
| 47 | virtual void ignite() override; |
| 48 | virtual std::string get_class() const override { return "goldbomb" ; } |
| 49 | virtual std::string get_display_name() const override { return _("Gold Bomb" ); } |
| 50 | |
| 51 | virtual void stop_looping_sounds() override; |
| 52 | virtual void play_looping_sounds() override; |
| 53 | |
| 54 | protected: |
| 55 | virtual bool collision_squished(GameObject& object) override; |
| 56 | |
| 57 | private: |
| 58 | enum Ticking_State { |
| 59 | STATE_NORMAL, |
| 60 | STATE_TICKING |
| 61 | }; |
| 62 | |
| 63 | private: |
| 64 | Ticking_State tstate; |
| 65 | |
| 66 | std::unique_ptr<SoundSource> ticking; |
| 67 | |
| 68 | private: |
| 69 | GoldBomb(const GoldBomb&) = delete; |
| 70 | GoldBomb& operator=(const GoldBomb&) = delete; |
| 71 | }; |
| 72 | |
| 73 | #endif |
| 74 | |
| 75 | /* EOF */ |
| 76 | |