c e n t e r

This commit is contained in:
Ben
2020-09-06 07:45:57 +01:00
parent 8a0afcb605
commit 27d52c05ad
3 changed files with 18 additions and 14 deletions

8
TODO
View File

@@ -11,8 +11,8 @@
[x] Better player spritesheet [x] Better player spritesheet
[x] Animation system [x] Animation system
[x] Sound [x] Sound
[ ] Enemies / AI [x] Enemies / AI
[ ] Dungeon fixed entity spawning [x] Dungeon fixed entity spawning
[ ] Enemy AI [x] Enemy AI
[ ] Gameplay [ ] Gameplay - Enemies can't survive the dark

View File

@@ -495,7 +495,7 @@ void Dungeon::Update(olc::PixelGameEngine* engine, float fTime)
olc::vf2d desiredLocation = Player->Coords; olc::vf2d desiredLocation = Player->Coords;
for (auto enemy : Enemies) for (auto enemy : Enemies)
{ {
enemy->Velocity = static_cast<float>(TileSize) * (fTime * (Player->Speed / 3.0f) * olc::vf2d(desiredLocation - enemy->Coords).norm()); enemy->Velocity = static_cast<float>(TileSize) * (fTime * (Player->Speed / 1.5f) * olc::vf2d(desiredLocation - enemy->Coords).norm());
enemy->Coords += enemy->Velocity; enemy->Coords += enemy->Velocity;
} }
@@ -538,7 +538,6 @@ void Dungeon::Draw(olc::PixelGameEngine* engine, float fTime)
for (int i = 0; i < Enemies.size(); i++) for (int i = 0; i < Enemies.size(); i++)
{ {
_Logger.Debug(i);
Enemies[i]->Animator->SetState("idle"); Enemies[i]->Animator->SetState("idle");
Enemies[i]->Animator->Draw(fTime, {Enemies[i]->Coords.x - ActiveCamera->Coords.x, Enemies[i]->Coords.y - ActiveCamera->Coords.y}); Enemies[i]->Animator->Draw(fTime, {Enemies[i]->Coords.x - ActiveCamera->Coords.x, Enemies[i]->Coords.y - ActiveCamera->Coords.y});
} }

View File

@@ -51,7 +51,8 @@ class Game : public olc::PixelGameEngine
SetDrawTarget(uint8_t(0)); SetDrawTarget(uint8_t(0));
Clear(olc::BLANK); Clear(olc::BLANK);
goto bruh;
// goto bruh;
if (_TimeAccumilator < 6.0f) if (_TimeAccumilator < 6.0f)
{ {
@@ -88,15 +89,19 @@ class Game : public olc::PixelGameEngine
_DeltaFade1 -= fTime * 200.0f; _DeltaFade1 -= fTime * 200.0f;
if (_DeltaFade1 < 0.1f) _DeltaFade1 = 0.0f; if (_DeltaFade1 < 0.1f) _DeltaFade1 = 0.0f;
} }
// TODO: Center these omd
SetPixelMode(olc::Pixel::ALPHA); SetPixelMode(olc::Pixel::ALPHA);
if (_TimeAccumilator > 16.0f) if (_TimeAccumilator > 16.0f)
DrawString((ScreenWidth() / 2) - (7 * 3) * (std::string("the machine has done nothing for me").length() / 2), 40, "the machine has done nothing for me", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 3); DrawString((ScreenWidth() / 2) - (7 * 4) * (std::string("the machine has done nothing for me").length() / 2), 40, "the machine has done nothing for me", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 3);
if (_TimeAccumilator > 20.0f) if (_TimeAccumilator > 20.0f)
DrawString((ScreenWidth() / 2) - (7 * 3) * (std::string("the machine has left me with nothing").length() / 2), 120, "the machine has left me with nothing", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 3); DrawString((ScreenWidth() / 2) - (7 * 4) * (std::string("the machine has left me with nothing").length() / 2), 120, "the machine has left me with nothing", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 3);
if (_TimeAccumilator > 23.0f) if (_TimeAccumilator > 23.0f)
DrawString((ScreenWidth() / 2) - (7 * 5) * (std::string("i am nothing").length() / 2), 300, "i am nothing", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 5);
DrawString((ScreenWidth() / 2) - (7 * 7) * (std::string("i am nothing").length() / 2), 300, "i am nothing", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 6);
if (_TimeAccumilator > 25.0f)
DrawString((ScreenWidth() / 2) - (7 * 3) * (std::string("your demons can't survive the dark").length() / 2), 650, "your demons can't survive the dark", olc::Pixel(255, 255, 255, static_cast<int>(_DeltaFade1)), 2);
} }
} }
if (_TimeAccumilator > 26.0f) if (_TimeAccumilator > 26.0f)