bumper.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright (C) 2020 Daniel Ward <weluvgoatz@gmail.com>
  2. //
  3. // This program is free software: you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation, either version 3 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. #ifndef HEADER_SUPERTUX_OBJECT_BUMPER_HPP
  16. #define HEADER_SUPERTUX_OBJECT_BUMPER_HPP
  17. #include "object/moving_sprite.hpp"
  18. #include "supertux/physic.hpp"
  19. enum class Direction;
  20. class Player;
  21. class Bumper final : public MovingSprite
  22. {
  23. public:
  24. Bumper(const ReaderMapping& reader);
  25. virtual ObjectSettings get_settings() override;
  26. virtual void update(float dt_sec) override;
  27. virtual HitResponse collision(GameObject& other, const CollisionHit& hit) override;
  28. static std::string class_name() { return "bumper"; }
  29. virtual std::string get_class_name() const override { return class_name(); }
  30. static std::string display_name() { return _("Bumper"); }
  31. virtual std::string get_display_name() const override { return display_name(); }
  32. virtual void after_editor_set() override;
  33. virtual void on_flip(float height) override;
  34. Physic& get_physic();
  35. private:
  36. Physic m_physic;
  37. Direction m_dir;
  38. private:
  39. Bumper(const Bumper&) = delete;
  40. Bumper& operator=(const Bumper&) = delete;
  41. };
  42. #endif
  43. /* EOF */