#pragma once #include "../GameEngine/Engine_Messaging_System/EngineMessageSystem.h" #include "../GameEngine/Engine_Messaging_System/MessageSystemEvent.h" #include "../GameEngine/Engine_Messages/MessageObserver.h" #include "../GameEngine/Engine_Messages/MessageHandler.h" #include "Box2D/Box2D/Dynamics/b2WorldCallbacks.h" #include "../GameEngine/Engine_Physics/Entity.h" #include "../GameEngine/Engine_Physics/RigidBodyPhysics.h" #include "../GameEngine/Engine_Graphics/Scene.h" #include "../GameEngine/Engine_Audio/AudioSoundEffect.h" #include "Game.h" #include "../GameEngine/Engine_Text/Text.h" #include "Box2D/Box2D/Dynamics/Contacts/b2Contact.h" #include "Score.h" // Control the player class PlayerControl : public EngineMessageSystem, public MessageObserver, public b2ContactListener { public: PlayerControl(Scene& scene, MessageHandler& messageHandler); void play(const sf::Time& elapsedTime) override; void onNotify(MessageEvent inputMessage) override; void BeginContact(b2Contact* inputB2Contact) override; void EndContact(b2Contact* inputB2Contact) override; void recieveEngineMessage(const SystemMessage& inputSystemMessage) override; protected: sf::RenderWindow* window; Profiler UILoadingTimesProfiler; Entity* entityPlayer; RigidBodyPhysics* physicsPlayer; const float playerJumpAbility = 10.0; const float playerMoveAbility = 5; float desiredVelocity = 0; bool checkPlayerJump = false; bool checkPlayerAtGround = false; int playerCurrentPosition; const float princess = 782; const float playerAim = 990; };