diff --git a/include/Core/CTransform.h b/include/Core/CTransform.h index 812e05e..06cbe5c 100644 --- a/include/Core/CTransform.h +++ b/include/Core/CTransform.h @@ -41,9 +41,6 @@ struct Transform : public Component glm::vec3 Velocity; /** Physical scale multiplier. */ glm::vec3 Scale; - - // Sticky is if it sticks with the player or not. True means it will follow the camera. - bool Sticky = true; }; } diff --git a/include/Core/Engine.h b/include/Core/Engine.h index 910f121..b397501 100755 --- a/include/Core/Engine.h +++ b/include/Core/Engine.h @@ -49,6 +49,7 @@ #include "Game/CBrick.h" #include "Game/CWall.h" #include "Game/CBackground.h" +#include "Game/CTravels.h" #include "Game/CStickyAim.h" #include "Game/BallSystem.h" #include "Game/HitLagSystem.h" @@ -128,6 +129,7 @@ public: m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); + m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); m_World->ComponentFactory.Register(); diff --git a/include/Game/BallSystem.h b/include/Game/BallSystem.h index d4faa03..585f805 100644 --- a/include/Game/BallSystem.h +++ b/include/Game/BallSystem.h @@ -93,7 +93,7 @@ public: private: float m_XMovementMultiplier = 2.f; - float m_EdgeX = 3.2f; + float m_EdgeX = 3.4f; //Actually 3.2, but anyways. float m_EdgeY = 5.2f; int m_MultiBalls = 0; int m_Lives = 3; diff --git a/include/Game/CTravels.h b/include/Game/CTravels.h new file mode 100644 index 0000000..9f4119b --- /dev/null +++ b/include/Game/CTravels.h @@ -0,0 +1,26 @@ +// +// Created by Adniklastrator on 2015-10-15. +// + +#ifndef DAYDREAM_CTRAVELS_H +#define DAYDREAM_CTRAVELS_H + +#include "Core/Component.h" + +namespace dd +{ + +namespace Components +{ + +struct Travels : Component +{ + //This indicates that the object moves upon moving to the next stage. Place this on an object that is to move. + //The camera does not move. Things that are to follow the camera should not have this component. +}; + +} + +} + +#endif //DAYDREAM_CTRAVELS_H diff --git a/include/Game/LevelSystem.h b/include/Game/LevelSystem.h index 9e29fb6..4b21091 100755 --- a/include/Game/LevelSystem.h +++ b/include/Game/LevelSystem.h @@ -25,6 +25,7 @@ #include "Game/CBackground.h" #include "Game/CProjectile.h" #include "Game/CPowerUp.h" +#include "Game/CTravels.h" #include "Game/BrickComponents.h" diff --git a/include/Game/TravellingSystem.h b/include/Game/TravellingSystem.h index ca18a88..9c5f54b 100644 --- a/include/Game/TravellingSystem.h +++ b/include/Game/TravellingSystem.h @@ -13,6 +13,7 @@ #include "Game/EPause.h" #include "Game/EArrivedAtNewStage.h" #include "Game/EStageCleared.h" +#include "Game/CTravels.h" namespace dd diff --git a/src/game/Game/BallSystem.cpp b/src/game/Game/BallSystem.cpp index c287e16..fa5e160 100644 --- a/src/game/Game/BallSystem.cpp +++ b/src/game/Game/BallSystem.cpp @@ -47,7 +47,6 @@ void dd::Systems::BallSystem::Initialize() physics->Category = CollisionLayer::Type::Ball; physics->Mask = static_cast(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy); physics->Calculate = true; - transform->Sticky = true; m_World->CommitEntity(ent); @@ -168,7 +167,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID return; } } //Removing this made the wall collisions work again - /*else if (transformBall->Position.x > EdgeX()) { + else if (transformBall->Position.x > EdgeX()) { if (transformBall->Velocity.x > 0) { glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(1, 0)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); @@ -178,7 +177,7 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(-1, 0)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); } - } else if (transformBall->Position.y > EdgeY()) { + } /*else if (transformBall->Position.y > EdgeY()) { if (transformBall->Velocity.y > 0) { glm::vec2 reflectedVelocity = glm::reflect(glm::vec2(transformBall->Velocity.x, transformBall->Velocity.y), glm::vec2(0, 1)); transformBall->Velocity = glm::vec3(reflectedVelocity, 0.f); @@ -419,7 +418,6 @@ void dd::Systems::BallSystem::CreateLife(int number) std::shared_ptr transform = m_World->AddComponent(life); transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f); transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f); - transform->Sticky = true; std::shared_ptr lifeNr = m_World->AddComponent(life); lifeNr->Number = number; diff --git a/src/game/Game/LevelSystem.cpp b/src/game/Game/LevelSystem.cpp index 00f1f2c..22f326c 100755 --- a/src/game/Game/LevelSystem.cpp +++ b/src/game/Game/LevelSystem.cpp @@ -11,22 +11,21 @@ void dd::Systems::LevelSystem::Initialize() { std::random_device rd; m_RandomGenerator = std::mt19937(rd()); - EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact); - EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall); - EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp); - EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost); - EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken); - EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); - EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); - EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); + EVENT_SUBSCRIBE_MEMBER(m_EContact, &LevelSystem::OnContact); + EVENT_SUBSCRIBE_MEMBER(m_EScoreEvent, &LevelSystem::OnScoreEvent); + EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &LevelSystem::OnMultiBall); + EVENT_SUBSCRIBE_MEMBER(m_ECreatePowerUp, &LevelSystem::OnCreatePowerUp); + EVENT_SUBSCRIBE_MEMBER(m_EMultiBallLost, &LevelSystem::OnMultiBallLost); + EVENT_SUBSCRIBE_MEMBER(m_EPowerUpTaken, &LevelSystem::OnPowerUpTaken); + EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &LevelSystem::OnStageCleared); + EVENT_SUBSCRIBE_MEMBER(m_EPause, &LevelSystem::OnPause); + EVENT_SUBSCRIBE_MEMBER(m_EHitPad, &LevelSystem::OnHitPad); //PointLightTest { auto t_Light = m_World->CreateEntity(); auto transform = m_World->AddComponent(t_Light); transform->Position = glm::vec3(-3.f, 6.f, -5.f); - transform->Sticky = true; auto pl = m_World->AddComponent(t_Light); pl->Radius = 20.f; pl->Diffuse = glm::vec3(0.8f, 0.7f, 0.05f); @@ -34,187 +33,184 @@ void dd::Systems::LevelSystem::Initialize() model->ModelFile = "Models/Core/UnitSphere.obj"; m_World->CommitEntity(t_Light); } - { - auto t_Light = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_Light); - transform->Position = glm::vec3(3.f, -5.f, -5.f); - transform->Sticky = true; - auto pl = m_World->AddComponent(t_Light); - pl->Radius = 15.f; - pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); - auto model = m_World->AddComponent(t_Light); - model->ModelFile = "Models/Core/UnitSphere.obj"; - m_World->CommitEntity(t_Light); - } + { + auto t_Light = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_Light); + transform->Position = glm::vec3(3.f, -5.f, -5.f); + auto pl = m_World->AddComponent(t_Light); + pl->Radius = 15.f; + pl->Diffuse = glm::vec3(0.1f, 0.5f, 0.8f); + auto model = m_World->AddComponent(t_Light); + model->ModelFile = "Models/Core/UnitSphere.obj"; + m_World->CommitEntity(t_Light); + } - //Halfpipe background test model. - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 0.f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } - { - auto t_halfPipe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_halfPipe); - transform->Position = glm::vec3(0.f, 34.6f, -15.f); - transform->Scale = glm::vec3(6.f, 6.f, 10.f); - transform->Sticky = false; - auto model = m_World->AddComponent(t_halfPipe); - model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; - model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); - m_World->CommitEntity(t_halfPipe); - } + //Halfpipe background test model. + { + auto t_halfPipe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_halfPipe); + auto background = m_World->AddComponent(t_halfPipe); + transform->Position = glm::vec3(0.f, 0.f, -15.f); + transform->Scale = glm::vec3(6.f, 6.f, 10.f); + auto travels = m_World->AddComponent(t_halfPipe); + auto model = m_World->AddComponent(t_halfPipe); + model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj"; + model->Color = glm::vec4(0.8f, 0.8f, 0.8f, 0.3f); + m_World->CommitEntity(t_halfPipe); - //Background + auto t_halfPipe2 = m_World->CloneEntity(t_halfPipe); + auto transform2 = m_World->GetComponent(t_halfPipe); + transform2->Position = glm::vec3(0.f, 34.6f, -15.f); + } - { - auto background = m_World->CreateEntity(); - auto transform = m_World->AddComponent(background); - transform->Position = glm::vec3(0.f, 0.f, -30.f); - transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); - auto sprite = m_World->AddComponent(background); - sprite->SpriteFile = "Textures/Background.png"; - m_World->CommitEntity(background); - } + //Background - // auto particleEmitter= m_World->AddComponent(Pe); - //Water test - { - auto t_waterBody = m_World->CreateEntity(); - auto transform = m_World->AddComponent(t_waterBody); - transform->Position = glm::vec3(0.f, -3.5f, -10.f); - transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); - transform->Sticky = true; - auto water = m_World->AddComponent(t_waterBody); - auto body = m_World->AddComponent(t_waterBody); - m_World->CommitEntity(t_waterBody); - } + { + auto background = m_World->CreateEntity(); + auto transform = m_World->AddComponent(background); + auto travels = m_World->AddComponent(background); + auto backgroundComponent = m_World->AddComponent(background); + transform->Position = glm::vec3(0.f, 0.f, -30.f); + transform->Scale = glm::vec3(2681.f / 50.f, 1080.f / 50.f, 1.f); + auto sprite = m_World->AddComponent(background); + sprite->SpriteFile = "Textures/Background.png"; + m_World->CommitEntity(background); + } - //ParticleTest + // auto particleEmitter= m_World->AddComponent(Pe); + //Water test + { + auto t_waterBody = m_World->CreateEntity(); + auto transform = m_World->AddComponent(t_waterBody); + transform->Position = glm::vec3(0.f, -3.5f, -10.f); + transform->Scale = glm::vec3(7.0f, 1.5f, 1.f); + auto water = m_World->AddComponent(t_waterBody); + auto body = m_World->AddComponent(t_waterBody); + m_World->CommitEntity(t_waterBody); + } + + //ParticleTest - /*{ - auto Pe = m_World->CreateEntity(); - auto transform = m_World->AddComponent(Pe); - auto particleEmitter= m_World->AddComponent(Pe); - auto emitteSprite = m_World->AddComponent(Pe); + /*{ + auto Pe = m_World->CreateEntity(); + auto transform = m_World->AddComponent(Pe); + auto particleEmitter= m_World->AddComponent(Pe); + auto emitteSprite = m_World->AddComponent(Pe); - transform->Position = glm::vec3(0.f, 0.f, -10.f); - emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; - particleEmitter->GravityScale = 0.0f; - particleEmitter->SpawnRate = 1.f; - particleEmitter->NumberOfTicks = 2; - particleEmitter->Speed = 1.f; - particleEmitter->ParticlesPerTick = 5; - particleEmitter->Spread = glm::pi()*2; - particleEmitter->EmittingAngle = glm::pi(); - particleEmitter->LifeTime = 50; + transform->Position = glm::vec3(0.f, 0.f, -10.f); + emitteSprite->SpriteFile = "Textures/Test/Brick_Normal.png"; + particleEmitter->GravityScale = 0.0f; + particleEmitter->SpawnRate = 1.f; + particleEmitter->NumberOfTicks = 2; + particleEmitter->Speed = 1.f; + particleEmitter->ParticlesPerTick = 5; + particleEmitter->Spread = glm::pi()*2; + particleEmitter->EmittingAngle = glm::pi(); + particleEmitter->LifeTime = 50; - { - auto Pt = m_World->CreateEntity(Pe); - auto PtTransform = m_World->AddComponent(Pt); - auto PtSprite = m_World->AddComponent(Pt); - auto PtParticle = m_World->AddComponent(Pt); - auto PtTemplate = m_World->AddComponent(Pt); + { + auto Pt = m_World->CreateEntity(Pe); + auto PtTransform = m_World->AddComponent(Pt); + auto PtSprite = m_World->AddComponent(Pt); + auto PtParticle = m_World->AddComponent(Pt); + auto PtTemplate = m_World->AddComponent(Pt); - //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); - PtTransform->Position = transform->Position; - PtSprite->SpriteFile = "Textures/Background.png"; - PtParticle->LifeTime = 3.f; - PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); - } - m_World->CommitEntity(Pe); - }*/ + //PtTransform->Velocity = glm::vec3(1.0f, 0.f, 0.f); + PtTransform->Position = transform->Position; + PtSprite->SpriteFile = "Textures/Background.png"; + PtParticle->LifeTime = 3.f; + PtParticle->Flags = static_cast(ParticleFlags::Type::Powder | ParticleFlags::Type::ParticleContactFilter | ParticleFlags::Type::FixtureContactFilter); + } + m_World->CommitEntity(Pe); + }*/ - //TODO: Why does the ball not collide with these bricks? - //BottomBox - { - auto BottomWall = m_World->CreateEntity(); - auto transform = m_World->AddComponent(BottomWall); - transform->Position = glm::vec3(0.f, -6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - //std::shared_ptr sprite = m_World->AddComponent(BottomWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - std::shared_ptr physics = m_World->AddComponent(BottomWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::LifeBuoy); - transform->Sticky = true; - m_World->CommitEntity(BottomWall); - } + //TODO: Why does the ball not collide with these bricks? + //BottomBox + { + auto BottomWall = m_World->CreateEntity(); + auto transform = m_World->AddComponent(BottomWall); + auto wall = m_World->AddComponent(BottomWall); + transform->Position = glm::vec3(0.f, -6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + //std::shared_ptr sprite = m_World->AddComponent(BottomWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + std::shared_ptr rectangleShape = m_World->AddComponent(BottomWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + std::shared_ptr physics = m_World->AddComponent(BottomWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::LifeBuoy); + m_World->CommitEntity(BottomWall); + } - { - auto topWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent(topWall); - transform->Position = glm::vec3(0.f, 6.f, -10.f); - transform->Scale = glm::vec3(20.f, 0.5f, 1.f); + { + auto topWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent(topWall); + transform->Position = glm::vec3(0.f, 6.f, -10.f); + transform->Scale = glm::vec3(20.f, 0.5f, 1.f); - //std::shared_ptr sprite = m_World->AddComponent(topWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + auto wall = m_World->AddComponent(topWall); - std::shared_ptr rectangleShape = m_World->AddComponent(topWall); - rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); + //std::shared_ptr sprite = m_World->AddComponent(topWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - std::shared_ptr physics = m_World->AddComponent(topWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + std::shared_ptr rectangleShape = m_World->AddComponent(topWall); + rectangleShape->Dimensions = glm::vec2(20.f, 0.5f); - m_World->CommitEntity(topWall); - } + std::shared_ptr physics = m_World->AddComponent(topWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - { - auto leftWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - leftWall); - transform->Position = glm::vec3(-4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + m_World->CommitEntity(topWall); + } - //std::shared_ptr sprite = m_World->AddComponent(leftWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + { + auto leftWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + leftWall); + transform->Position = glm::vec3(-4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + auto wall = m_World->AddComponent(leftWall); - std::shared_ptr physics = m_World->AddComponent(leftWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + //std::shared_ptr sprite = m_World->AddComponent(leftWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; - m_World->CommitEntity(leftWall); - } + std::shared_ptr rectangleShape = m_World->AddComponent(leftWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); - { - auto rightWall = m_World->CreateEntity(); - std::shared_ptr transform = m_World->AddComponent( - rightWall); - transform->Position = glm::vec3(4.f, 1.f, -10.f); - transform->Scale = glm::vec3(0.5f, 20.f, 1.f); + std::shared_ptr physics = m_World->AddComponent(leftWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); - //std::shared_ptr sprite = m_World->AddComponent(rightWall); - //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + m_World->CommitEntity(leftWall); + } - std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); - rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + { + auto rightWall = m_World->CreateEntity(); + std::shared_ptr transform = m_World->AddComponent( + rightWall); + transform->Position = glm::vec3(4.f, 1.f, -10.f); + transform->Scale = glm::vec3(0.5f, 20.f, 1.f); - std::shared_ptr physics = m_World->AddComponent(rightWall); - physics->CollisionType = CollisionType::Type::Static; - physics->Category = CollisionLayer::Wall; - physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick); - transform->Sticky = true; + auto wall = m_World->AddComponent(rightWall); - m_World->CommitEntity(rightWall); - } + //std::shared_ptr sprite = m_World->AddComponent(rightWall); + //sprite->SpriteFile = "Textures/Core/ErrorTexture.png"; + + std::shared_ptr rectangleShape = m_World->AddComponent(rightWall); + rectangleShape->Dimensions = glm::vec2(0.5f, 20.f); + + std::shared_ptr physics = m_World->AddComponent(rightWall); + physics->CollisionType = CollisionType::Type::Static; + physics->Category = CollisionLayer::Wall; + physics->Mask = static_cast(/*CollisionLayer::Ball |*/ CollisionLayer::Brick); + + m_World->CommitEntity(rightWall); + } m_BrickTemplate = m_World->CreateEntity(); std::shared_ptr transform = m_World->AddComponent(m_BrickTemplate); @@ -224,11 +220,13 @@ void dd::Systems::LevelSystem::Initialize() cRec->Dimensions = glm::vec2(0.9f, 0.35f); std::shared_ptr cPhys = m_World->AddComponent(m_BrickTemplate); std::shared_ptr cTemplate = m_World->AddComponent(m_BrickTemplate); + + auto travels = m_World->AddComponent(m_BrickTemplate); + cPhys->CollisionType = CollisionType::Type::Static; cPhys->GravityScale = 0.f; cPhys->Category = CollisionLayer::Type::Brick; cPhys->Mask = static_cast(CollisionLayer::Type::Ball | CollisionLayer::Type::Projectile | CollisionLayer::Type::Wall | CollisionLayer::LifeBuoy); - transform->Sticky = false; model->ModelFile = "Models/Brick/WhiteBrick.obj"; transform->Position = glm::vec3(50, 50, -10); @@ -633,7 +631,6 @@ bool dd::Systems::LevelSystem::OnCreatePowerUp(const dd::Events::CreatePowerUp & cPhys->CollisionType = CollisionType::Type::Dynamic; cPhys->Category = CollisionLayer::Type::PowerUp; cPhys->Mask = CollisionLayer::Type::Pad; - transform->Sticky = false; std::shared_ptr cPow = m_World->AddComponent(powerUp); diff --git a/src/game/Game/LifebuoySystem.cpp b/src/game/Game/LifebuoySystem.cpp index e1361c6..3265a63 100644 --- a/src/game/Game/LifebuoySystem.cpp +++ b/src/game/Game/LifebuoySystem.cpp @@ -29,7 +29,6 @@ void dd::Systems::LifebuoySystem::Initialize() physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::Brick | CollisionLayer::LifeBuoy | CollisionLayer::Pad | CollisionLayer::Water); physics->Density = 1.0f; physics->GravityScale = 1; - ctransform->Sticky = true; auto cModel = m_World->AddComponent(ent); cModel->ModelFile = "Models/Lifebuoy/Lifebuoy1.obj"; auto lifebuoy = m_World->AddComponent(ent); diff --git a/src/game/Game/PadSystem.cpp b/src/game/Game/PadSystem.cpp index 7a47d8f..17a8327 100755 --- a/src/game/Game/PadSystem.cpp +++ b/src/game/Game/PadSystem.cpp @@ -49,7 +49,6 @@ void dd::Systems::PadSystem::Initialize() physics->Category = CollisionLayer::Type::Pad; physics->Mask = static_cast(CollisionLayer::Ball | CollisionLayer::PowerUp | CollisionLayer::LifeBuoy); physics->Calculate = true; - ctransform->Sticky = true; auto cModel = m_World->AddComponent(ent); cModel->ModelFile = "Models/Ship/Ship.obj"; @@ -396,7 +395,6 @@ bool dd::Systems::PadSystem::OnRaiseWater(const dd::Events::RaiseWater &event) auto transform = m_World->AddComponent(t_waterBody); transform->Position = glm::vec3(0.f, -3.5f, -10.f); transform->Scale = glm::vec3(7.0f, event.Amount * 1.6f, 1.f); - transform->Sticky = true; auto water = m_World->AddComponent(t_waterBody); auto body = m_World->AddComponent(t_waterBody); m_World->CommitEntity(t_waterBody); diff --git a/src/game/Game/ProjectileSystem.cpp b/src/game/Game/ProjectileSystem.cpp index 566a009..a6b9bc1 100644 --- a/src/game/Game/ProjectileSystem.cpp +++ b/src/game/Game/ProjectileSystem.cpp @@ -29,7 +29,6 @@ void dd::Systems::ProjectileSystem::Initialize() physics->Category = CollisionLayer::Type::Projectile; physics->Mask = static_cast(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall); physics->Calculate = true; - ctransform->Sticky = true; ctransform->Position = glm::vec3(0.f, 0.f, -10.f); ctransform->Scale = glm::vec3(0.1f, 0.1f, 0.1f); auto cModel = m_World->AddComponent(ent); diff --git a/src/game/Game/TravellingSystem.cpp b/src/game/Game/TravellingSystem.cpp index a073488..baa5dad 100644 --- a/src/game/Game/TravellingSystem.cpp +++ b/src/game/Game/TravellingSystem.cpp @@ -31,15 +31,13 @@ void dd::Systems::TravellingSystem::Update(double dt) void dd::Systems::TravellingSystem::UpdateEntity(double dt, EntityID entity, EntityID parent) { if (m_Travelling) { - auto transform = m_World->GetComponent(entity); - if (transform != nullptr) { - if (!transform->Sticky) { + auto travels = m_World->GetComponent(entity); + if (travels != nullptr) { + auto transform = m_World->GetComponent(entity); + if (transform != nullptr) { transform->Position.y -= 6.0f * dt; } } - else { - transform->Position.y -= 6.0f * dt; - } } }