Squid does not move until space is pressed. Experimenting with scroll. This shouldn't really be committed, but Visual Studio.
This commit is contained in:
@@ -41,6 +41,9 @@ struct Transform : public Component
|
|||||||
glm::vec3 Velocity;
|
glm::vec3 Velocity;
|
||||||
/** Physical scale multiplier. */
|
/** Physical scale multiplier. */
|
||||||
glm::vec3 Scale;
|
glm::vec3 Scale;
|
||||||
|
|
||||||
|
// Sticky is if it sticks with the player or not. True means it will follow the camera.
|
||||||
|
bool Sticky;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,11 +168,22 @@ public:
|
|||||||
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
||||||
transform->Position = glm::vec3(0.f, 0.f, -15.f);
|
transform->Position = glm::vec3(0.f, 0.f, -15.f);
|
||||||
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
||||||
|
transform->Sticky = false;
|
||||||
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
||||||
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
||||||
model->Color = glm::vec4(1.f, 0.f, 0.f, 0.3f);
|
model->Color = glm::vec4(1.f, 0.f, 0.f, 0.3f);
|
||||||
m_World->CommitEntity(t_halfPipe);
|
m_World->CommitEntity(t_halfPipe);
|
||||||
}
|
}
|
||||||
|
/*{
|
||||||
|
auto t_halfPipe = m_World->CreateEntity();
|
||||||
|
auto transform = m_World->AddComponent<Components::Transform>(t_halfPipe);
|
||||||
|
transform->Position = glm::vec3(0.f, 6.f, -15.f);
|
||||||
|
transform->Scale = glm::vec3(6.f, 6.f, 10.f);
|
||||||
|
auto model = m_World->AddComponent<Components::Model>(t_halfPipe);
|
||||||
|
model->ModelFile = "Models/Test/halfpipe/Halfpipe.obj";
|
||||||
|
model->Color = glm::vec4(1.f, 0.f, 0.f, 0.3f);
|
||||||
|
m_World->CommitEntity(t_halfPipe);
|
||||||
|
}*/
|
||||||
|
|
||||||
//Background
|
//Background
|
||||||
{
|
{
|
||||||
@@ -247,6 +258,7 @@ public:
|
|||||||
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
rectangleShape->Dimensions = glm::vec2(20.f, 0.5f);
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(BottomWall);
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(BottomWall);
|
||||||
physics->CollisionType = CollisionType::Type::Static;
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
|
transform->Sticky = true;
|
||||||
m_World->CommitEntity(BottomWall);
|
m_World->CommitEntity(BottomWall);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,6 +278,7 @@ public:
|
|||||||
physics->CollisionType = CollisionType::Type::Static;
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
physics->Category = CollisionLayer::Wall;
|
physics->Category = CollisionLayer::Wall;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
transform->Sticky = true;
|
||||||
|
|
||||||
m_World->CommitEntity(topWall);
|
m_World->CommitEntity(topWall);
|
||||||
}
|
}
|
||||||
@@ -287,6 +300,7 @@ public:
|
|||||||
physics->CollisionType = CollisionType::Type::Static;
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
physics->Category = CollisionLayer::Wall;
|
physics->Category = CollisionLayer::Wall;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
transform->Sticky = true;
|
||||||
|
|
||||||
m_World->CommitEntity(leftWall);
|
m_World->CommitEntity(leftWall);
|
||||||
}
|
}
|
||||||
@@ -308,6 +322,8 @@ public:
|
|||||||
physics->CollisionType = CollisionType::Type::Static;
|
physics->CollisionType = CollisionType::Type::Static;
|
||||||
physics->Category = CollisionLayer::Wall;
|
physics->Category = CollisionLayer::Wall;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::Brick);
|
||||||
|
transform->Sticky = true;
|
||||||
|
|
||||||
m_World->CommitEntity(rightWall);
|
m_World->CommitEntity(rightWall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/EHitPad.h"
|
#include "Game/EHitPad.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
|
#include "Game/EActionButton.h"
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,7 @@ private:
|
|||||||
int m_PastLives = 3;
|
int m_PastLives = 3;
|
||||||
bool m_ReplaceBall = false;
|
bool m_ReplaceBall = false;
|
||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
|
bool m_Waiting = true;
|
||||||
EntityID m_LastCollision = 999999;
|
EntityID m_LastCollision = 999999;
|
||||||
|
|
||||||
glm::vec3 m_SavedSpeed;
|
glm::vec3 m_SavedSpeed;
|
||||||
@@ -104,7 +106,8 @@ private:
|
|||||||
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
|
dd::EventRelay<BallSystem, dd::Events::ResetBall> m_EResetBall;
|
||||||
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
|
dd::EventRelay<BallSystem, dd::Events::MultiBall> m_EMultiBall;
|
||||||
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
|
dd::EventRelay<BallSystem, dd::Events::Pause> m_EPause;
|
||||||
EventRelay<BallSystem, Events::Contact> m_Contact;
|
dd::EventRelay<BallSystem, dd::Events::Contact> m_Contact;
|
||||||
|
dd::EventRelay<BallSystem, dd::Events::ActionButton> m_EActionButton;
|
||||||
|
|
||||||
bool Contact(const Events::Contact &event);
|
bool Contact(const Events::Contact &event);
|
||||||
bool OnLifeLost(const dd::Events::LifeLost &event);
|
bool OnLifeLost(const dd::Events::LifeLost &event);
|
||||||
@@ -112,6 +115,7 @@ private:
|
|||||||
bool OnResetBall(const dd::Events::ResetBall &event);
|
bool OnResetBall(const dd::Events::ResetBall &event);
|
||||||
bool OnMultiBall(const dd::Events::MultiBall &event);
|
bool OnMultiBall(const dd::Events::MultiBall &event);
|
||||||
bool OnPause(const dd::Events::Pause &event);
|
bool OnPause(const dd::Events::Pause &event);
|
||||||
|
bool OnActionButton(const dd::Events::ActionButton &event);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ struct Ball : Component
|
|||||||
float Speed = 5.f;
|
float Speed = 5.f;
|
||||||
int Combo = 0;
|
int Combo = 0;
|
||||||
bool Paused = false;
|
bool Paused = false;
|
||||||
|
bool Waiting = true;
|
||||||
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
|
glm::vec3 SavedSpeed = glm::vec3(0, 0, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2015-10-07.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef DAYDREAM_EACTIONBUTTON_H
|
||||||
|
#define DAYDREAM_EACTIONBUTTON_H
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
|
||||||
|
namespace dd
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ActionButton : Event
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //DAYDREAM_EACTIONBUTTON_H
|
||||||
@@ -13,7 +13,8 @@ namespace Events
|
|||||||
{
|
{
|
||||||
struct StageCleared : Event
|
struct StageCleared : Event
|
||||||
{
|
{
|
||||||
|
int StageCleared = 0;
|
||||||
|
int StageCluster = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "Game/EStageCleared.h"
|
#include "Game/EStageCleared.h"
|
||||||
#include "Game/EPause.h"
|
#include "Game/EPause.h"
|
||||||
#include "Game/EHitLag.h"
|
#include "Game/EHitLag.h"
|
||||||
|
#include "Game/EActionButton.h"
|
||||||
|
|
||||||
|
|
||||||
namespace dd
|
namespace dd
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EResetBall, &BallSystem::OnResetBall);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall);
|
EVENT_SUBSCRIBE_MEMBER(m_EMultiBall, &BallSystem::OnMultiBall);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &BallSystem::OnPause);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EActionButton, &BallSystem::OnActionButton);
|
||||||
|
|
||||||
//OctoBall
|
//OctoBall
|
||||||
{
|
{
|
||||||
@@ -33,12 +34,14 @@ void dd::Systems::BallSystem::Initialize()
|
|||||||
circleShape->Radius = 0.4f;
|
circleShape->Radius = 0.4f;
|
||||||
std::shared_ptr<Components::Ball> ball = m_World->AddComponent<Components::Ball>(ent);
|
std::shared_ptr<Components::Ball> ball = m_World->AddComponent<Components::Ball>(ent);
|
||||||
ball->Speed = 5.f;
|
ball->Speed = 5.f;
|
||||||
|
ball->Waiting = true;
|
||||||
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(ent);
|
std::shared_ptr<Components::Physics> physics = m_World->AddComponent<Components::Physics>(ent);
|
||||||
std::shared_ptr<Components::Template> ballTemplate = m_World->AddComponent<Components::Template>(ent);
|
std::shared_ptr<Components::Template> ballTemplate = m_World->AddComponent<Components::Template>(ent);
|
||||||
physics->CollisionType = CollisionType::Type::Dynamic;
|
physics->CollisionType = CollisionType::Type::Dynamic;
|
||||||
physics->Category = CollisionLayer::Type::Ball;
|
physics->Category = CollisionLayer::Type::Ball;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Type::Pad | CollisionLayer::Type::Brick | CollisionLayer::Type::Wall);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
|
transform->Sticky = true;
|
||||||
|
|
||||||
//auto plight = m_World->AddComponent<Components::PointLight>(ent);
|
//auto plight = m_World->AddComponent<Components::PointLight>(ent);
|
||||||
//plight->Radius = 2.f;
|
//plight->Radius = 2.f;
|
||||||
@@ -100,12 +103,23 @@ void dd::Systems::BallSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
if (ballComponent != nullptr) {
|
if (ballComponent != nullptr) {
|
||||||
|
if (ballComponent->Waiting) {
|
||||||
|
if (m_Waiting == false) {
|
||||||
|
ballComponent->Waiting = false;
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
transform->Velocity = glm::normalize(glm::vec3(0.5f, 1, 0.f)) * ballComponent->Speed;
|
||||||
|
} else {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
transform->Velocity = glm::vec3(0.f, 0.f, 0.f);
|
||||||
|
transform->Position = glm::vec3(0.0f, -3.f, -10.f);
|
||||||
|
transform->Orientation = glm::quat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ReplaceBall()) {
|
if (ReplaceBall()) {
|
||||||
SetReplaceBall(false);
|
SetReplaceBall(false);
|
||||||
|
m_Waiting = true;
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
ballComponent->Waiting = true;
|
||||||
transform->Position = glm::vec3(0.0f, 0.26f, -10.f);
|
|
||||||
transform->Velocity = glm::vec3(0.0f, -ballComponent->Speed, 0.f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto transformBall = m_World->GetComponent<Components::Transform>(entity);
|
auto transformBall = m_World->GetComponent<Components::Transform>(entity);
|
||||||
@@ -324,6 +338,7 @@ void dd::Systems::BallSystem::CreateLife(int number)
|
|||||||
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(life);
|
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(life);
|
||||||
transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f);
|
transform->Position = glm::vec3(-1.5f + number * 0.15f, -2.f, -5.f);
|
||||||
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
transform->Scale = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||||
|
transform->Sticky = true;
|
||||||
|
|
||||||
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
std::shared_ptr<Components::Life> lifeNr = m_World->AddComponent<Components::Life>(life);
|
||||||
lifeNr->Number = number;
|
lifeNr->Number = number;
|
||||||
@@ -367,6 +382,8 @@ bool dd::Systems::BallSystem::OnMultiBall(const dd::Events::MultiBall &event)
|
|||||||
auto transform2 = m_World->GetComponent<Components::Transform>(ent2);
|
auto transform2 = m_World->GetComponent<Components::Transform>(ent2);
|
||||||
auto ball1 = m_World->GetComponent<Components::Ball>(ent1);
|
auto ball1 = m_World->GetComponent<Components::Ball>(ent1);
|
||||||
auto ball2 = m_World->GetComponent<Components::Ball>(ent2);
|
auto ball2 = m_World->GetComponent<Components::Ball>(ent2);
|
||||||
|
ball1->Waiting = false;
|
||||||
|
ball2->Waiting = false;
|
||||||
auto padTransform = event.padTransform;
|
auto padTransform = event.padTransform;
|
||||||
float x1 = padTransform->Position.x - 2, x2 = padTransform->Position.x + 2;
|
float x1 = padTransform->Position.x - 2, x2 = padTransform->Position.x + 2;
|
||||||
if (x1 < -m_EdgeX) {
|
if (x1 < -m_EdgeX) {
|
||||||
@@ -386,3 +403,9 @@ bool dd::Systems::BallSystem::OnMultiBall(const dd::Events::MultiBall &event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dd::Systems::BallSystem::OnActionButton(const dd::Events::ActionButton &event)
|
||||||
|
{
|
||||||
|
m_Waiting = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ void dd::Systems::LevelSystem::Initialize()
|
|||||||
cPhys->GravityScale = 0.f;
|
cPhys->GravityScale = 0.f;
|
||||||
cPhys->Category = CollisionLayer::Type::Brick;
|
cPhys->Category = CollisionLayer::Type::Brick;
|
||||||
cPhys->Mask = CollisionLayer::Type::Ball;
|
cPhys->Mask = CollisionLayer::Type::Ball;
|
||||||
|
transform->Sticky = false;
|
||||||
|
|
||||||
model->ModelFile = "Models/Brick/TurquoiseBrick.obj";
|
model->ModelFile = "Models/Brick/TurquoiseBrick.obj";
|
||||||
transform->Position = glm::vec3(50, 50, -10);
|
transform->Position = glm::vec3(50, 50, -10);
|
||||||
@@ -61,6 +62,17 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
auto templateCheck = m_World->GetComponent<Components::Template>(entity);
|
||||||
if (templateCheck != nullptr){ return; }
|
if (templateCheck != nullptr){ return; }
|
||||||
|
|
||||||
|
// Check the background.
|
||||||
|
auto model = m_World->GetComponent<Components::Model>(entity);
|
||||||
|
if (model != nullptr) {
|
||||||
|
if (model->ModelFile == "Models/Test/halfpipe/Halfpipe.obj") {
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (transform->Position.y <= -12) {
|
||||||
|
transform->Position.y = 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto brick = m_World->GetComponent<Components::Brick>(entity);
|
auto brick = m_World->GetComponent<Components::Brick>(entity);
|
||||||
if (brick != nullptr) {
|
if (brick != nullptr) {
|
||||||
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
@@ -81,6 +93,8 @@ void dd::Systems::LevelSystem::UpdateEntity(double dt, EntityID entity, EntityID
|
|||||||
if (NumberOfBricks() <= 0 && m_LooseBricks <= 0 && !Restarting()) {
|
if (NumberOfBricks() <= 0 && m_LooseBricks <= 0 && !Restarting()) {
|
||||||
if (MultiBalls() <= 0 && PowerUps() <= 0) {
|
if (MultiBalls() <= 0 && PowerUps() <= 0) {
|
||||||
Events::StageCleared ec;
|
Events::StageCleared ec;
|
||||||
|
ec.StageCleared = m_CurrentLevel;
|
||||||
|
ec.StageCluster = m_CurrentCluster;
|
||||||
EventBroker->Publish(ec);
|
EventBroker->Publish(ec);
|
||||||
} else {
|
} else {
|
||||||
if (ball != nullptr && MultiBalls() > 0) {
|
if (ball != nullptr && MultiBalls() > 0) {
|
||||||
@@ -304,6 +318,7 @@ bool dd::Systems::LevelSystem::OnCreatePowerUp(const dd::Events::CreatePowerUp &
|
|||||||
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
cPhys->CollisionType = CollisionType::Type::Dynamic;
|
||||||
cPhys->Category = CollisionLayer::Type::PowerUp;
|
cPhys->Category = CollisionLayer::Type::PowerUp;
|
||||||
cPhys->Mask = CollisionLayer::Type::Pad;
|
cPhys->Mask = CollisionLayer::Type::Pad;
|
||||||
|
transform->Sticky = false;
|
||||||
|
|
||||||
std::shared_ptr<Components::PowerUp> cPow = m_World->AddComponent<Components::PowerUp>(powerUp);
|
std::shared_ptr<Components::PowerUp> cPow = m_World->AddComponent<Components::PowerUp>(powerUp);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp);
|
EVENT_SUBSCRIBE_MEMBER(m_EContactPowerUp, &PadSystem::OnContactPowerUp);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
EVENT_SUBSCRIBE_MEMBER(m_EStageCleared, &PadSystem::OnStageCleared);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
EVENT_SUBSCRIBE_MEMBER(m_EPause, &PadSystem::OnPause);
|
||||||
|
//EVENT_SUBSCRIBE_MEMBER(m_EBindKey, &PadSystem::OnBindKey);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto ent = m_World->CreateEntity();
|
auto ent = m_World->CreateEntity();
|
||||||
@@ -41,6 +42,7 @@ void dd::Systems::PadSystem::Initialize()
|
|||||||
physics->Category = CollisionLayer::Type::Pad;
|
physics->Category = CollisionLayer::Type::Pad;
|
||||||
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp);
|
physics->Mask = static_cast<CollisionLayer::Type>(CollisionLayer::Ball | CollisionLayer::PowerUp);
|
||||||
physics->Calculate = true;
|
physics->Calculate = true;
|
||||||
|
ctransform->Sticky = true;
|
||||||
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
auto cModel = m_World->AddComponent<Components::Model>(ent);
|
||||||
cModel->ModelFile = "Models/Submarine2.obj";
|
cModel->ModelFile = "Models/Submarine2.obj";
|
||||||
|
|
||||||
@@ -123,8 +125,7 @@ bool dd::Systems::PadSystem::OnPause(const dd::Events::Pause &event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event)
|
bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event) {
|
||||||
{
|
|
||||||
int val = event.KeyCode;
|
int val = event.KeyCode;
|
||||||
if (val == GLFW_KEY_UP) {
|
if (val == GLFW_KEY_UP) {
|
||||||
//std::cout << "Up!" << std::endl;
|
//std::cout << "Up!" << std::endl;
|
||||||
@@ -154,6 +155,9 @@ bool dd::Systems::PadSystem::OnKeyDown(const dd::Events::KeyDown &event)
|
|||||||
e.Time = 0.2;
|
e.Time = 0.2;
|
||||||
e.Type = "All";
|
e.Type = "All";
|
||||||
EventBroker->Publish(e);
|
EventBroker->Publish(e);
|
||||||
|
} else if (val == GLFW_KEY_SPACE) {
|
||||||
|
Events::ActionButton e;
|
||||||
|
EventBroker->Publish(e);
|
||||||
} else if (val == GLFW_KEY_D) {
|
} else if (val == GLFW_KEY_D) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,13 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
|||||||
|
|
||||||
void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
void dd::Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
|
||||||
{
|
{
|
||||||
|
auto transform = m_World->GetComponent<Components::Transform>(entity);
|
||||||
|
if (transform != nullptr) {
|
||||||
|
if (transform->Sticky == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
transform->Position.y -= 1.0f * dt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dd::Systems::PhysicsSystem::OnPause(const dd::Events::Pause &event)
|
bool dd::Systems::PhysicsSystem::OnPause(const dd::Events::Pause &event)
|
||||||
|
|||||||
Reference in New Issue
Block a user