Player.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. #include <SFML/Audio.hpp>
  4. #include "AnimatedSprite.hpp"
  5. #include "IEntity.hpp"
  6. #include "Renderer.hpp"
  7. #include "Collider.hpp"
  8. #include "Voice.hpp"
  9. #include "Endthing.hpp"
  10. using namespace sf;
  11. #define HOPS 10
  12. class Player: public AnimatedSprite, public IEntity {
  13. public:
  14. Player();
  15. virtual ~Player();
  16. void update(float dt) override;
  17. void announce(float dist) {
  18. static bool trig_fuck = false;
  19. static float scare = 0.f;
  20. //Log(DEBUG, )
  21. if (!trig_fuck && dist < 300.f) {
  22. m_voice.addLine("data/nem/what3.wav", 0.f);
  23. m_voice.addSubtitle(0.f, 1.f, "What was that?");
  24. trig_fuck = true;
  25. }
  26. if (dist < 300.f) {
  27. scare += 300.f - dist;
  28. }
  29. if (scare > 12000.f && m_voice.isFree()) {
  30. m_voice.addLine("data/nem/aaa" + std::to_string(rand() % 7 + 1) + ".wav", 0.5f, true);
  31. m_voice.addSubtitle(0.5f, 0.5f, "!?");
  32. scare = 0.f;
  33. }
  34. }
  35. void cheat() {
  36. m_cheat = true;
  37. }
  38. sf::Vector2f getSpawnerPosition() {
  39. return m_end.getPosition();
  40. }
  41. private:
  42. Collider m_collider;
  43. Voice m_voice;
  44. float m_ms;
  45. sf::Clock m_intro_clock;
  46. AnimatedSprite m_notnem;
  47. Endthing m_end;
  48. sf::Sound m_brown;
  49. bool m_cheat{ false };
  50. };