trampoline.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SuperTux - Trampoline
  2. // Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_OBJECT_TRAMPOLINE_HPP
  17. #define HEADER_SUPERTUX_OBJECT_TRAMPOLINE_HPP
  18. #include "object/rock.hpp"
  19. /** Jumping on a trampoline makes tux jump higher. */
  20. class Trampoline final : public Rock
  21. {
  22. public:
  23. Trampoline(const ReaderMapping& reader);
  24. Trampoline(const Vector& pos, int type);
  25. virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
  26. virtual void update(float dt_sec) override;
  27. virtual void grab(MovingObject&, const Vector& pos, Direction) override;
  28. virtual bool is_portable() const override;
  29. static std::string class_name() { return "trampoline"; }
  30. virtual std::string get_class_name() const override { return class_name(); }
  31. static std::string display_name() { return _("Trampoline"); }
  32. virtual std::string get_display_name() const override { return display_name(); }
  33. GameObjectTypes get_types() const override;
  34. std::string get_default_sprite_name() const override;
  35. public:
  36. enum Type {
  37. PORTABLE,
  38. STATIONARY
  39. };
  40. private:
  41. Trampoline(const Trampoline&) = delete;
  42. Trampoline& operator=(const Trampoline&) = delete;
  43. };
  44. #endif
  45. /* EOF */