Ball hitting bricks destroys bricks! We can PLAY! (kind of)

This commit is contained in:
PlatinumSkink
2015-09-11 10:50:49 +02:00
parent 7e945c85d3
commit c829315598
8 changed files with 151 additions and 44 deletions
+10 -7
View File
@@ -20,13 +20,6 @@ void dd::Systems::PadSystem::Initialize()
l.Command = "left";
EventBroker->Publish(l);
ent = m_World->CreateEntity();
transform = m_World->AddComponent<Components::Transform>(ent);
transform->Position = glm::vec3(0.f, -5.f, -10.f);
transform->Scale = glm::vec3(3.2, 0.8, 0.);
sprite = m_World->AddComponent<Components::Sprite>(ent);
sprite->SpriteFile = "Textures/Pad.png";
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, PadSystem::OnKeyDown);
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, PadSystem::OnKeyUp);
@@ -35,6 +28,16 @@ void dd::Systems::PadSystem::Initialize()
void dd::Systems::PadSystem::Update(double dt)
{
if (ent == 0) {
for (auto it = m_World->GetEntities()->begin(); it != m_World->GetEntities()->end(); it++) {
if (m_World->GetProperty<std::string>(it->first, "Name") == "Pad") {
ent = it->first;
transform = m_World->GetComponent<Components::Transform>(ent);
break;
}
}
}
if (transform->Velocity.x < -400.f)
{
transform->Velocity.x = -400.f;