diff --git a/assets/Textures/Combo/Combo.psd b/assets/Textures/Combo/Combo.psd new file mode 100755 index 0000000..a37a1fa Binary files /dev/null and b/assets/Textures/Combo/Combo.psd differ diff --git a/assets/Textures/Combo/Combo001.png b/assets/Textures/Combo/Combo001.png new file mode 100755 index 0000000..2d45db7 Binary files /dev/null and b/assets/Textures/Combo/Combo001.png differ diff --git a/assets/Textures/Combo/Combo002.png b/assets/Textures/Combo/Combo002.png new file mode 100755 index 0000000..85be71e Binary files /dev/null and b/assets/Textures/Combo/Combo002.png differ diff --git a/assets/Textures/Combo/Combo003.png b/assets/Textures/Combo/Combo003.png new file mode 100755 index 0000000..63dfc3c Binary files /dev/null and b/assets/Textures/Combo/Combo003.png differ diff --git a/assets/Textures/Combo/Combo004.png b/assets/Textures/Combo/Combo004.png new file mode 100755 index 0000000..080b201 Binary files /dev/null and b/assets/Textures/Combo/Combo004.png differ diff --git a/assets/Textures/Combo/Combo005.png b/assets/Textures/Combo/Combo005.png new file mode 100755 index 0000000..799126e Binary files /dev/null and b/assets/Textures/Combo/Combo005.png differ diff --git a/assets/Textures/Combo/Combo006.png b/assets/Textures/Combo/Combo006.png new file mode 100755 index 0000000..a4dba7a Binary files /dev/null and b/assets/Textures/Combo/Combo006.png differ diff --git a/assets/Textures/Combo/Combo007.png b/assets/Textures/Combo/Combo007.png new file mode 100755 index 0000000..f08bb81 Binary files /dev/null and b/assets/Textures/Combo/Combo007.png differ diff --git a/assets/Textures/Combo/Combo008.png b/assets/Textures/Combo/Combo008.png new file mode 100755 index 0000000..b2da97d Binary files /dev/null and b/assets/Textures/Combo/Combo008.png differ diff --git a/assets/Textures/Combo/Combo009.png b/assets/Textures/Combo/Combo009.png new file mode 100755 index 0000000..56a6ab9 Binary files /dev/null and b/assets/Textures/Combo/Combo009.png differ diff --git a/assets/Textures/Combo/Combo010.png b/assets/Textures/Combo/Combo010.png new file mode 100755 index 0000000..527bf45 Binary files /dev/null and b/assets/Textures/Combo/Combo010.png differ diff --git a/assets/Textures/Combo/Combo011.png b/assets/Textures/Combo/Combo011.png new file mode 100755 index 0000000..e6954e6 Binary files /dev/null and b/assets/Textures/Combo/Combo011.png differ diff --git a/assets/Textures/Combo/Combo012.png b/assets/Textures/Combo/Combo012.png new file mode 100755 index 0000000..cf935a6 Binary files /dev/null and b/assets/Textures/Combo/Combo012.png differ diff --git a/assets/Textures/Combo/Combo013.png b/assets/Textures/Combo/Combo013.png new file mode 100755 index 0000000..1bdce3b Binary files /dev/null and b/assets/Textures/Combo/Combo013.png differ diff --git a/assets/Textures/Combo/Combo014.png b/assets/Textures/Combo/Combo014.png new file mode 100755 index 0000000..61c4acd Binary files /dev/null and b/assets/Textures/Combo/Combo014.png differ diff --git a/assets/Textures/Combo/Combo015.png b/assets/Textures/Combo/Combo015.png new file mode 100755 index 0000000..1c93896 Binary files /dev/null and b/assets/Textures/Combo/Combo015.png differ diff --git a/assets/Textures/Combo/Combo016.png b/assets/Textures/Combo/Combo016.png new file mode 100755 index 0000000..43d5a3d Binary files /dev/null and b/assets/Textures/Combo/Combo016.png differ diff --git a/assets/Textures/Combo/Combo017.png b/assets/Textures/Combo/Combo017.png new file mode 100755 index 0000000..f492038 Binary files /dev/null and b/assets/Textures/Combo/Combo017.png differ diff --git a/assets/Textures/Combo/Combo018.png b/assets/Textures/Combo/Combo018.png new file mode 100755 index 0000000..71156f8 Binary files /dev/null and b/assets/Textures/Combo/Combo018.png differ diff --git a/assets/Textures/Combo/Combo019.png b/assets/Textures/Combo/Combo019.png new file mode 100755 index 0000000..fb8e5ab Binary files /dev/null and b/assets/Textures/Combo/Combo019.png differ diff --git a/assets/Textures/Combo/Combo020.png b/assets/Textures/Combo/Combo020.png new file mode 100755 index 0000000..573b937 Binary files /dev/null and b/assets/Textures/Combo/Combo020.png differ diff --git a/assets/Textures/Combo/Combo021.png b/assets/Textures/Combo/Combo021.png new file mode 100755 index 0000000..397b7ed Binary files /dev/null and b/assets/Textures/Combo/Combo021.png differ diff --git a/assets/Textures/Combo/Combo022.png b/assets/Textures/Combo/Combo022.png new file mode 100755 index 0000000..c75a2b7 Binary files /dev/null and b/assets/Textures/Combo/Combo022.png differ diff --git a/assets/Textures/Combo/Combo023.png b/assets/Textures/Combo/Combo023.png new file mode 100755 index 0000000..1b94495 Binary files /dev/null and b/assets/Textures/Combo/Combo023.png differ diff --git a/assets/Textures/Combo/Combo024.png b/assets/Textures/Combo/Combo024.png new file mode 100755 index 0000000..6a738d6 Binary files /dev/null and b/assets/Textures/Combo/Combo024.png differ diff --git a/assets/Textures/Combo/Combo025.png b/assets/Textures/Combo/Combo025.png new file mode 100755 index 0000000..612d457 Binary files /dev/null and b/assets/Textures/Combo/Combo025.png differ diff --git a/assets/Textures/Combo/Combo026.png b/assets/Textures/Combo/Combo026.png new file mode 100755 index 0000000..7d335d6 Binary files /dev/null and b/assets/Textures/Combo/Combo026.png differ diff --git a/assets/Textures/Combo/Combo027.png b/assets/Textures/Combo/Combo027.png new file mode 100755 index 0000000..15f8379 Binary files /dev/null and b/assets/Textures/Combo/Combo027.png differ diff --git a/assets/Textures/Combo/Combo028.png b/assets/Textures/Combo/Combo028.png new file mode 100755 index 0000000..388361a Binary files /dev/null and b/assets/Textures/Combo/Combo028.png differ diff --git a/assets/Textures/Combo/Combo029.png b/assets/Textures/Combo/Combo029.png new file mode 100755 index 0000000..bec65f4 Binary files /dev/null and b/assets/Textures/Combo/Combo029.png differ diff --git a/assets/Textures/Combo/Combo030.png b/assets/Textures/Combo/Combo030.png new file mode 100755 index 0000000..8c6fb5a Binary files /dev/null and b/assets/Textures/Combo/Combo030.png differ diff --git a/assets/Textures/Combo/Combo031.png b/assets/Textures/Combo/Combo031.png new file mode 100755 index 0000000..589923d Binary files /dev/null and b/assets/Textures/Combo/Combo031.png differ diff --git a/assets/Textures/Combo/Combo032.png b/assets/Textures/Combo/Combo032.png new file mode 100755 index 0000000..1960a25 Binary files /dev/null and b/assets/Textures/Combo/Combo032.png differ diff --git a/assets/Textures/Combo/Combo033.png b/assets/Textures/Combo/Combo033.png new file mode 100755 index 0000000..0bef6cf Binary files /dev/null and b/assets/Textures/Combo/Combo033.png differ diff --git a/assets/Textures/Combo/Combo034.png b/assets/Textures/Combo/Combo034.png new file mode 100755 index 0000000..0794fb4 Binary files /dev/null and b/assets/Textures/Combo/Combo034.png differ diff --git a/assets/Textures/Combo/Combo035.png b/assets/Textures/Combo/Combo035.png new file mode 100755 index 0000000..fb7ae0c Binary files /dev/null and b/assets/Textures/Combo/Combo035.png differ diff --git a/assets/Textures/Combo/Combo036.png b/assets/Textures/Combo/Combo036.png new file mode 100755 index 0000000..657b8ba Binary files /dev/null and b/assets/Textures/Combo/Combo036.png differ diff --git a/assets/Textures/Combo/Combo037.png b/assets/Textures/Combo/Combo037.png new file mode 100755 index 0000000..2efe233 Binary files /dev/null and b/assets/Textures/Combo/Combo037.png differ diff --git a/assets/Textures/Combo/Combo038.png b/assets/Textures/Combo/Combo038.png new file mode 100755 index 0000000..28b81dc Binary files /dev/null and b/assets/Textures/Combo/Combo038.png differ diff --git a/assets/Textures/Combo/Combo039.png b/assets/Textures/Combo/Combo039.png new file mode 100755 index 0000000..23a9349 Binary files /dev/null and b/assets/Textures/Combo/Combo039.png differ diff --git a/assets/Textures/Combo/Combo040.png b/assets/Textures/Combo/Combo040.png new file mode 100755 index 0000000..647ed5f Binary files /dev/null and b/assets/Textures/Combo/Combo040.png differ diff --git a/assets/Textures/Combo/Combo041.png b/assets/Textures/Combo/Combo041.png new file mode 100755 index 0000000..3fff340 Binary files /dev/null and b/assets/Textures/Combo/Combo041.png differ diff --git a/assets/Textures/Combo/Combo042.png b/assets/Textures/Combo/Combo042.png new file mode 100755 index 0000000..c3e2b6d Binary files /dev/null and b/assets/Textures/Combo/Combo042.png differ diff --git a/assets/Textures/Combo/Combo043.png b/assets/Textures/Combo/Combo043.png new file mode 100755 index 0000000..fa3c906 Binary files /dev/null and b/assets/Textures/Combo/Combo043.png differ diff --git a/assets/Textures/GUI/Numbers/ScoreBackgroundLeft.png b/assets/Textures/GUI/Numbers/ScoreBackgroundLeft.png new file mode 100755 index 0000000..dd1054d Binary files /dev/null and b/assets/Textures/GUI/Numbers/ScoreBackgroundLeft.png differ diff --git a/assets/Textures/GUI/Numbers/ScoreBackgroundMid.png b/assets/Textures/GUI/Numbers/ScoreBackgroundMid.png new file mode 100755 index 0000000..bd424df Binary files /dev/null and b/assets/Textures/GUI/Numbers/ScoreBackgroundMid.png differ diff --git a/assets/Textures/GUI/Numbers/ScoreBackgroundRight.png b/assets/Textures/GUI/Numbers/ScoreBackgroundRight.png new file mode 100755 index 0000000..d0d4c36 Binary files /dev/null and b/assets/Textures/GUI/Numbers/ScoreBackgroundRight.png differ diff --git a/include/Game/BallSystem.h b/include/Game/BallSystem.h index 1f9aa30..d4faa03 100644 --- a/include/Game/BallSystem.h +++ b/include/Game/BallSystem.h @@ -1,151 +1,152 @@ -#ifndef DAYDREAM_BALLSYSTEM_H -#define DAYDREAM_BALLSYSTEM_H - -#include "Core/System.h" -#include "Core/World.h" -#include "Core/EventBroker.h" -#include "Core/CTransform.h" -#include "Core/CTemplate.h" -#include "Physics/CPhysics.h" -#include "Physics/CCircleShape.h" -#include "Physics/CRectangleShape.h" -#include "Physics/EContact.h" -#include "Rendering/CModel.h" -#include "Rendering/CSprite.h" -#include "Rendering/CPointLight.h" -#include "Game/CBall.h" -#include "Game/CPowerUp.h" -#include "Game/CLife.h" -#include "Game/CBrick.h" -#include "Game/CLifebuoy.h" -#include "Game/ELifeLost.h" -#include "Game/EComboEvent.h" -#include "Game/EResetBall.h" -#include "Game/EMultiBall.h" -#include "Game/EMultiBallLost.h" -#include "Game/EStickyPad.h" -#include "Game/EStickyAttachedToPad.h" -#include "Game/EInkBlaster.h" -#include "Game/EInkBlasterOver.h" -#include "Game/EStageCleared.h" -#include "Game/EArrivedAtNewStage.h" -#include "Game/EGameOver.h" -#include "Game/EPause.h" -#include "Game/EHitPad.h" -#include "Game/EHitLag.h" +#ifndef DAYDREAM_BALLSYSTEM_H +#define DAYDREAM_BALLSYSTEM_H + +#include "Core/System.h" +#include "Core/World.h" +#include "Core/EventBroker.h" +#include "Core/CTransform.h" +#include "Core/CTemplate.h" +#include "Physics/CPhysics.h" +#include "Physics/CCircleShape.h" +#include "Physics/CRectangleShape.h" +#include "Physics/EContact.h" +#include "Rendering/CModel.h" +#include "Rendering/CSprite.h" +#include "Rendering/CPointLight.h" +#include "Game/CBall.h" +#include "Game/CPowerUp.h" +#include "Game/CLife.h" +#include "Game/CBrick.h" +#include "Game/CLifebuoy.h" +#include "Game/ELifeLost.h" +#include "Game/EComboEvent.h" +#include "Game/EResetBall.h" +#include "Game/EMultiBall.h" +#include "Game/EMultiBallLost.h" +#include "Game/EStickyPad.h" +#include "Game/EStickyAttachedToPad.h" +#include "Game/EInkBlaster.h" +#include "Game/EInkBlasterOver.h" +#include "Game/EStageCleared.h" +#include "Game/EArrivedAtNewStage.h" +#include "Game/EGameOver.h" +#include "Game/EPause.h" +#include "Game/EHitPad.h" +#include "Game/EHitLag.h" #include "Game/EActionButton.h" -#include "Game/ELifebuoyHit.h" - -namespace dd -{ - -namespace Systems -{ - -class BallSystem : public System -{ -public: - BallSystem(World *world, std::shared_ptr eventBroker) - : System(world, eventBroker) { } - - ~BallSystem(); - - - - void RegisterComponents(ComponentFactory *cf) override; - - void Initialize() override; - - // Called once per system every tick - void Update(double dt) override; - - // Called once for every entity in the world every tick - void UpdateEntity(double dt, EntityID entity, EntityID parent) override; - - // Called when components are committed to an entity - void OnEntityCommit(EntityID entity) override; - - // Called when an entity is removed - void OnEntityRemoved(EntityID entity) override; - - EntityID CreateBall(); - void CreateLife(int); - EntityID Ball() { return m_Ball; }; - void SetBall(const EntityID& ball) { m_Ball = ball; } - - float& XMovementMultiplier() { return m_XMovementMultiplier; } - void SetXMovementMultiplier(const float& xMovementMultiplier) { m_XMovementMultiplier = xMovementMultiplier; } - float& EdgeX() { return m_EdgeX; } - void SetEdgeX(const float& edgeX) { m_EdgeX = edgeX; } - float& EdgeY() { return m_EdgeY; } - void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; } - int& MultiBalls() { return m_MultiBalls; } - void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; } - int& Lives() { return m_Lives; } - void SetLives(const int& lives) { m_Lives = lives; } - int& PastLives() { return m_PastLives; } - void SetPastLives(const int& pastLives) { m_PastLives = pastLives; } - bool ReplaceBall() const { return m_ReplaceBall; } - void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; } - bool IsPaused() const { return m_Pause; } - void SetPause(const bool& pause) { m_Pause = pause; } - -private: - float m_XMovementMultiplier = 2.f; - float m_EdgeX = 3.2f; - float m_EdgeY = 5.2f; - int m_MultiBalls = 0; - int m_Lives = 3; - int m_PastLives = 3; - bool m_ReplaceBall = false; - bool m_Pause = false; - bool m_Waiting = true; - bool m_Sticky = false; - bool m_InkBlaster = false; - bool m_InkAttached = false; - bool m_InkBlockedWaiting = false; - bool m_Restarting = false; - int m_StickyCounter = 3; - - bool m_StageBlockedWaiting = false; - - glm::vec3 m_SavedSpeed; - bool m_InitializePause = false; - - EntityID m_Ball; - - std::unordered_map> m_Contacts; - void ResolveContacts(); - - dd::EventRelay m_ELifeLost; - dd::EventRelay m_EMultiBallLost; - dd::EventRelay m_EResetBall; - dd::EventRelay m_EMultiBall; - dd::EventRelay m_EStickyPad; - dd::EventRelay m_EInkBlaster; - dd::EventRelay m_EInkBlasterOver; - dd::EventRelay m_EPause; - dd::EventRelay m_Contact; - dd::EventRelay m_EActionButton; - dd::EventRelay m_EStageCleared; - dd::EventRelay m_EArrivedAtNewStage; - - bool Contact(const Events::Contact &event); - bool OnLifeLost(const dd::Events::LifeLost &event); - bool OnMultiBallLost(const dd::Events::MultiBallLost &event); - bool OnResetBall(const dd::Events::ResetBall &event); - bool OnMultiBall(const dd::Events::MultiBall &event); - bool OnStickyPad(const dd::Events::StickyPad &event); - bool OnInkBlaster(const dd::Events::InkBlaster &event); - bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event); - bool OnPause(const dd::Events::Pause &event); - bool OnActionButton(const dd::Events::ActionButton &event); - bool OnStageCleared(const dd::Events::StageCleared &event); - bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event); -}; - -} - -} - -#endif +#include "Game/ELifebuoyHit.h" +#include "Physics/ECreateParticleSequence.h" + +namespace dd +{ + +namespace Systems +{ + +class BallSystem : public System +{ +public: + BallSystem(World *world, std::shared_ptr eventBroker) + : System(world, eventBroker) { } + + ~BallSystem(); + + + + void RegisterComponents(ComponentFactory *cf) override; + + void Initialize() override; + + // Called once per system every tick + void Update(double dt) override; + + // Called once for every entity in the world every tick + void UpdateEntity(double dt, EntityID entity, EntityID parent) override; + + // Called when components are committed to an entity + void OnEntityCommit(EntityID entity) override; + + // Called when an entity is removed + void OnEntityRemoved(EntityID entity) override; + + EntityID CreateBall(); + void CreateLife(int); + EntityID Ball() { return m_Ball; }; + void SetBall(const EntityID& ball) { m_Ball = ball; } + + float& XMovementMultiplier() { return m_XMovementMultiplier; } + void SetXMovementMultiplier(const float& xMovementMultiplier) { m_XMovementMultiplier = xMovementMultiplier; } + float& EdgeX() { return m_EdgeX; } + void SetEdgeX(const float& edgeX) { m_EdgeX = edgeX; } + float& EdgeY() { return m_EdgeY; } + void SetEdgeY(const float& edgeY) { m_EdgeY = edgeY; } + int& MultiBalls() { return m_MultiBalls; } + void SetMultiBalls(const int& multiBalls) { m_MultiBalls = multiBalls; } + int& Lives() { return m_Lives; } + void SetLives(const int& lives) { m_Lives = lives; } + int& PastLives() { return m_PastLives; } + void SetPastLives(const int& pastLives) { m_PastLives = pastLives; } + bool ReplaceBall() const { return m_ReplaceBall; } + void SetReplaceBall(const bool& replaceBall) { m_ReplaceBall = replaceBall; } + bool IsPaused() const { return m_Pause; } + void SetPause(const bool& pause) { m_Pause = pause; } + +private: + float m_XMovementMultiplier = 2.f; + float m_EdgeX = 3.2f; + float m_EdgeY = 5.2f; + int m_MultiBalls = 0; + int m_Lives = 3; + int m_PastLives = 3; + bool m_ReplaceBall = false; + bool m_Pause = false; + bool m_Waiting = true; + bool m_Sticky = false; + bool m_InkBlaster = false; + bool m_InkAttached = false; + bool m_InkBlockedWaiting = false; + bool m_Restarting = false; + int m_StickyCounter = 3; + + bool m_StageBlockedWaiting = false; + + glm::vec3 m_SavedSpeed; + bool m_InitializePause = false; + + EntityID m_Ball; + + std::unordered_map> m_Contacts; + void ResolveContacts(); + + dd::EventRelay m_ELifeLost; + dd::EventRelay m_EMultiBallLost; + dd::EventRelay m_EResetBall; + dd::EventRelay m_EMultiBall; + dd::EventRelay m_EStickyPad; + dd::EventRelay m_EInkBlaster; + dd::EventRelay m_EInkBlasterOver; + dd::EventRelay m_EPause; + dd::EventRelay m_Contact; + dd::EventRelay m_EActionButton; + dd::EventRelay m_EStageCleared; + dd::EventRelay m_EArrivedAtNewStage; + + bool Contact(const Events::Contact &event); + bool OnLifeLost(const dd::Events::LifeLost &event); + bool OnMultiBallLost(const dd::Events::MultiBallLost &event); + bool OnResetBall(const dd::Events::ResetBall &event); + bool OnMultiBall(const dd::Events::MultiBall &event); + bool OnStickyPad(const dd::Events::StickyPad &event); + bool OnInkBlaster(const dd::Events::InkBlaster &event); + bool OnInkBlasterOver(const dd::Events::InkBlasterOver &event); + bool OnPause(const dd::Events::Pause &event); + bool OnActionButton(const dd::Events::ActionButton &event); + bool OnStageCleared(const dd::Events::StageCleared &event); + bool OnArrivedToNewStage(const dd::Events::ArrivedAtNewStage &event); +}; + +} + +} + +#endif diff --git a/include/Game/GUI/HUD.h b/include/Game/GUI/HUD.h index 8236d4a..2a7d889 100644 --- a/include/Game/GUI/HUD.h +++ b/include/Game/GUI/HUD.h @@ -26,8 +26,14 @@ public: Width = parent->Width; Height = parent->Height; - m_ScoreBackground = new GUI::TextureFrame(this, "HUDScoreBackgroundFrame"); - m_ScoreBackground->SetTexture("Textures/GUI/Numbers/Background.png"); + m_ScoreBackMid = new GUI::TextureFrame(this, "HUDScoreBackgroundFrame"); + m_ScoreBackMid->SetTexture("Textures/GUI/Numbers/ScoreBackgroundMid.png"); + + m_ScoreBackLeft = new GUI::TextureFrame(this, "HUDScoreBackgroundLeftFrame"); + m_ScoreBackLeft->SetTexture("Textures/GUI/Numbers/ScoreBackgroundLeft.png"); + + m_ScoreBackRight = new GUI::TextureFrame(this, "HUDScoreBackgroundRightFrame"); + m_ScoreBackRight->SetTexture("Textures/GUI/Numbers/ScoreBackgroundRight.png"); m_ScoreNumberFrame = new GUI::NumberFrame(this, "HUDScoreNumberFrame"); //m_ScoreNumberFrame->X = 15; m_ScoreNumberFrame->Y = 18; @@ -52,7 +58,9 @@ public: private: - TextureFrame* m_ScoreBackground = nullptr; + TextureFrame* m_ScoreBackMid = nullptr; + TextureFrame* m_ScoreBackLeft = nullptr; + TextureFrame* m_ScoreBackRight = nullptr; NumberFrame* m_ScoreNumberFrame = nullptr; FPSCounter* m_FPSCounter = nullptr; TextureFrame* m_GameOverFrame = nullptr; @@ -67,9 +75,18 @@ private: void updateScore() { m_ScoreNumberFrame->SetLeft(Width / 2.f - m_ScoreNumberFrame->Width / 2.f); - m_ScoreBackground->SetLeft(m_ScoreNumberFrame->Left() - 20); - m_ScoreBackground->Width = m_ScoreNumberFrame->Width + 40; - m_ScoreBackground->Height = m_ScoreNumberFrame->Height + 30; + + m_ScoreBackMid->SetLeft(m_ScoreNumberFrame->Left()); + m_ScoreBackMid->Width = m_ScoreNumberFrame->Width; + m_ScoreBackMid->Height = m_ScoreNumberFrame->Height + 35; + + m_ScoreBackLeft->SetRight(m_ScoreBackMid->Left()); + m_ScoreBackLeft->Width = 40; + m_ScoreBackLeft->Height = m_ScoreBackMid->Height; + + m_ScoreBackRight->SetLeft(m_ScoreBackMid->Right()); + m_ScoreBackRight->Width = 40; + m_ScoreBackRight->Height = m_ScoreBackMid->Height; } bool OnScore(const Events::ScoreEvent& event) diff --git a/include/Physics/PhysicsSystem.h b/include/Physics/PhysicsSystem.h index 60fd02e..0927eec 100755 --- a/include/Physics/PhysicsSystem.h +++ b/include/Physics/PhysicsSystem.h @@ -57,9 +57,6 @@ namespace dd ~PhysicsSystem(); - EventRelay m_ECreateParticleSequence; - bool CreateParticleSequence(const Events::CreateParticleSequence &event); - void RegisterComponents(ComponentFactory* cf) override; void Initialize() override; void Update(double dt) override; @@ -116,6 +113,8 @@ namespace dd bool OnPause(const dd::Events::Pause &event); dd::EventRelay m_EContact; bool OnContact(const dd::Events::Contact &event); + EventRelay m_ECreateParticleSequence; + bool CreateParticleSequence(const Events::CreateParticleSequence &event); //TODO: Fill struct with info needed. struct EmitterHandler //TODO CHANGE NAMES diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index cb1f671..c287e16 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -26,6 +26,7 @@ void dd::Systems::BallSystem::Initialize() EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &BallSystem::OnStageCleared); EVENT_SUBSCRIBE_MEMBER(m_EArrivedAtNewStage, &BallSystem::OnArrivedToNewStage); + //OctoBall { auto ent = m_World->CreateEntity(); @@ -291,7 +292,41 @@ bool dd::Systems::BallSystem::Contact(const Events::Contact &event) float x = (ballTransform->Position.x - padTransform->Position.x) * XMovementMultiplier(); float y = glm::cos((abs(x) / (1.6f)) * glm::pi() / 2.f) + 1.f; - ballComponent->Combo = 0; + //When a combo is more than 2 create a particle showing it. + if (ballComponent->Combo >= 2){ + + Events::CreateParticleSequence particleEvent; + + particleEvent.EmitterLifeTime = 3; + particleEvent.EmittingAngle = glm::half_pi(); + particleEvent.Spread = 0.f; + particleEvent.NumberOfTicks = 1; + particleEvent.ParticleLifeTime = 2.f; + particleEvent.ParticlesPerTick = 1; + particleEvent.Position = glm::vec3(ballTransform->Position.x, -3.f, -3.f); + if (ballTransform->Position.x >= 2.7f) { + particleEvent.Position = glm::vec3(2.7f, -3.f, -3.f); + } else if (ballTransform->Position.x <= -2.7f) { + particleEvent.Position = glm::vec3(-2.7f, -3.f, -3.f); + } + particleEvent.Radius = 1.f; + particleEvent.Color = glm::vec4(1.f); + particleEvent.Speed = 0; + + if (ballComponent->Combo <= 9) { + particleEvent.SpriteFile = "Textures/Combo/Combo00" + std::to_string(ballComponent->Combo) + ".png"; + } else if (ballComponent->Combo <= 42) { + particleEvent.SpriteFile = "Textures/Combo/Combo0" + std::to_string(ballComponent->Combo) + ".png"; + } else { + particleEvent.SpriteFile = "Textures/Combo/Combo043.png"; + } + EventBroker->Publish(particleEvent); + } + + + + + ballComponent->Combo = 56; if (!ballComponent->Waiting) { if (m_InkBlaster) { if (!m_InkAttached) {