endsequence_fireworks.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SuperTux - End Sequence: Tux walks right
  2. // Copyright (C) 2007 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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. #include "object/endsequence_fireworks.hpp"
  17. #include "object/fireworks.hpp"
  18. #include "object/player.hpp"
  19. #include "supertux/screen_manager.hpp"
  20. #include "supertux/sector.hpp"
  21. EndSequenceFireworks::EndSequenceFireworks() :
  22. EndSequence(),
  23. endsequence_timer()
  24. {
  25. }
  26. EndSequenceFireworks::~EndSequenceFireworks()
  27. {
  28. }
  29. void
  30. EndSequenceFireworks::draw(DrawingContext& /*context*/)
  31. {
  32. }
  33. void
  34. EndSequenceFireworks::starting()
  35. {
  36. EndSequence::starting();
  37. endsequence_timer.start(7.3f * ScreenManager::current()->get_speed());
  38. Sector::get().add<Fireworks>();
  39. }
  40. void
  41. EndSequenceFireworks::running(float dt_sec)
  42. {
  43. EndSequence::running(dt_sec);
  44. for (const auto& player : Sector::get().get_players())
  45. if (!m_tux_is_stopped[player->get_id()])
  46. get_code_controller(player->get_id())->press(Control::JUMP);
  47. if (endsequence_timer.check()) m_is_done = true;
  48. }
  49. void
  50. EndSequenceFireworks::stopping()
  51. {
  52. EndSequence::stopping();
  53. }
  54. /* EOF */