rusty_trampoline.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SuperTux - Rusty Trampoline
  2. // Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
  3. // Copyright (C) 2011 Jonas Kuemmerlin <rgcjonas@googlemail.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. #ifndef HEADER_SUPERTUX_OBJECT_RUSTY_TRAMPOLINE_HPP
  18. #define HEADER_SUPERTUX_OBJECT_RUSTY_TRAMPOLINE_HPP
  19. #include "object/rock.hpp"
  20. /** Jumping on a trampoline makes tux jump higher.
  21. After 3 jumps, it breaks (configurable)
  22. It cannot be carried (breaks on ungrab) */
  23. class RustyTrampoline final : public Rock
  24. {
  25. public:
  26. RustyTrampoline(const ReaderMapping& reader);
  27. virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
  28. virtual void collision_solid(const CollisionHit& hit) override;
  29. virtual void update(float dt_sec) override;
  30. virtual void grab(MovingObject&, const Vector& pos, Direction) override;
  31. virtual void ungrab(MovingObject&, Direction) override;
  32. virtual bool is_portable() const override;
  33. static std::string class_name() { return "rustytrampoline"; }
  34. virtual std::string get_class_name() const override { return class_name(); }
  35. static std::string display_name() { return _("Rusty Trampoline"); }
  36. virtual std::string get_display_name() const override { return display_name(); }
  37. virtual ObjectSettings get_settings() override;
  38. GameObjectTypes get_types() const override { return {}; }
  39. private:
  40. bool portable;
  41. int counter;
  42. private:
  43. RustyTrampoline(const RustyTrampoline&) = delete;
  44. RustyTrampoline& operator=(const RustyTrampoline&) = delete;
  45. };
  46. #endif
  47. /* EOF */