Made a Stage! Imported PlaceHolder Graphics!

This commit is contained in:
PlatinumSkink
2015-09-10 21:06:21 +02:00
parent 6a81751e56
commit 16c5d2a40f
11 changed files with 22 additions and 13 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+5 -5
View File
@@ -42,10 +42,10 @@ public:
void Initialize() override;
void CreateBasicLevel(int, int, int, int);
void SaveLevel(int, int, int, int); // Shouldn't be here, but I'm experimenting.
void CreateBasicLevel(int, int, glm::vec2, int);
void SaveLevel(int, int, glm::vec2, int); // Shouldn't be here, but I'm experimenting.
void LoadLevel(char[20]);
void CreateBrick(int, int, int, int);
void CreateBrick(int, int, glm::vec2, int, int);
void ProcessCollision();
void OnEntityRemoved(EntityID entity);
@@ -54,9 +54,9 @@ public:
private:
int numberOfBricks;
int tRows = 8;
int tRows = 7;
int tLines = 8;
int tSpaceBetweenBricks = 2;
glm::vec2 tSpaceBetweenBricks = glm::vec2(2, 0.5);
int tSpaceToEdge = 0;
};
+15 -7
View File
@@ -16,29 +16,37 @@ void dd::Systems::LevelSystem::Initialize()
return;
}
void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, int spacesBetweenBricks, int spaceToEdge)
void dd::Systems::LevelSystem::CreateBasicLevel(int rows, int lines, glm::vec2 spacesBetweenBricks, int spaceToEdge)
{
int num = 0;
numberOfBricks = rows * lines;
for (int i = 0; i < rows; i++)
{
num++;
for (int j = 0; j < lines; j++)
{
CreateBrick(i, j, spacesBetweenBricks, spaceToEdge);
CreateBrick(i, j, spacesBetweenBricks, spaceToEdge, num);
}
if (num == 7)
num = 0;
}
return;
}
void dd::Systems::LevelSystem::CreateBrick(int row, int line, int spacesBetweenBricks, int spaceToEdge)
void dd::Systems::LevelSystem::CreateBrick(int row, int line, glm::vec2 spacesBetweenBricks, int spaceToEdge, int num)
{
auto brick = m_World->CreateEntity();
std::shared_ptr<Components::Transform> transform = m_World->AddComponent<Components::Transform>(brick);
std::shared_ptr<Components::Sprite> sprite = m_World->AddComponent<Components::Sprite>(brick);
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
float x = spaceToEdge + line * spacesBetweenBricks;
float y = spaceToEdge + row * spacesBetweenBricks;
transform->Position = glm::vec3(x-5, y-5, -10.f);
std::string fileName = "Textures/Bricks/";
fileName.append(std::to_string(num));
fileName.append(".png");
sprite->SpriteFile = fileName;
float x = spaceToEdge + line * spacesBetweenBricks.x;
float y = spaceToEdge + row * spacesBetweenBricks.y;
transform->Scale = glm::vec3(0.8, 0.2, 0.);
transform->Position = glm::vec3(x - 7, y + 1, -10.f);
//sprite->Color = glm::vec4(1.f, 1.f, 1.f, 1.f);
return;
}
+2 -1
View File
@@ -23,8 +23,9 @@ void dd::Systems::PadSystem::Initialize()
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(1.6, 0.4, 0.);
sprite = m_World->AddComponent<Components::Sprite>(ent);
sprite->SpriteFile = "Textures/Core/ErrorTexture.png";
sprite->SpriteFile = "Textures/Pad.png";
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, PadSystem::OnKeyDown);
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, PadSystem::OnKeyUp);