diff --git a/Faceball2030/Editor.cpp b/Faceball2030/Editor.cpp index 83892d6..f0ccc65 100644 --- a/Faceball2030/Editor.cpp +++ b/Faceball2030/Editor.cpp @@ -65,6 +65,18 @@ void Editor::Update(float fElapsedTime){ if (game->GetMouse(1).bPressed) { t.enemyId = EnemyID::NONE; } + if (game->GetKey(DOWN).bHeld) { + t.facingDir = FacingDirection::SOUTH; + } + if (game->GetKey(RIGHT).bHeld) { + t.facingDir = FacingDirection::EAST; + } + if (game->GetKey(UP).bHeld) { + t.facingDir = FacingDirection::NORTH; + } + if (game->GetKey(LEFT).bHeld) { + t.facingDir = FacingDirection::WEST; + } game->FillRectDecal(squarePos, GRID_SIZE, { 0,0,255,64 }); } //game->DrawRectDecal(squarePos,GRID_SIZE,{64,64,64}); @@ -79,6 +91,9 @@ void Editor::Update(float fElapsedTime){ } else { game->DrawDecal(squarePos, game->circle, { 1,1 }, game->GetData(t.enemyId).col); + if (t.enemyId >= START) { + game->DrawRotatedDecal(squarePos + vf2d{16, 16}, game->arrow, PI / 2 * (int)t.facingDir, { 16,16 }, { 1,1 }, WHITE); + } } } game->DrawLineDecal(squarePos,{squarePos.x+ (float)GRID_SIZE.x,squarePos.y},t.wallN?WHITE:Pixel{64,64,64}); diff --git a/Faceball2030/Editor.h b/Faceball2030/Editor.h index 92e0c59..59a4394 100644 --- a/Faceball2030/Editor.h +++ b/Faceball2030/Editor.h @@ -9,6 +9,7 @@ enum class FacingDirection { enum EnemyID { NONE, EXIT, + START, SHOOTME, COIN = 56, POWERUP_ARMOR = 57, diff --git a/Faceball2030/assets/arrow.png b/Faceball2030/assets/arrow.png new file mode 100644 index 0000000..1f6c571 Binary files /dev/null and b/Faceball2030/assets/arrow.png differ diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index fe1d4a6..6f0968f 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -9,7 +9,9 @@ using namespace olc; FaceBall* game; void FaceBall::InitializeEnemyData() { + enemyData[EnemyID::NONE] = { "VOID",BLACK }; enemyData[EXIT] = { "EXIT",GREEN }; + enemyData[START] = { "SPAWN POSITION",{128,64,0} }; enemyData[SHOOTME] = { "SHOOTME",YELLOW,1,1,PI / 8,2,1,3 }; enemyData[COIN] = { "Coin",BLUE }; enemyData[POWERUP_ARMOR] = { "Armor",{96,0,96} }; @@ -606,6 +608,7 @@ bool FaceBall::OnUserCreate() matProj = Matrix_MakeProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.1f, 1000.0f); dot = new Decal(new Sprite("assets/dot.png")); circle = new Decal(new Sprite("assets/circle.png")); + arrow = new Decal(new Sprite("assets/arrow.png")); enemy_ShootMe_tex = new Decal(new Sprite("assets/enemies/ShootMe.png")); InitializeEnemyData(); diff --git a/Faceball2030/main.h b/Faceball2030/main.h index 64c6df1..4e080e8 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -149,7 +149,7 @@ class FaceBall : public PixelGameEngine } EnemyData GetData(EnemyID id); - Decal* circle; + Decal* circle,*arrow; private: Mesh mapMesh; diff --git a/Faceball2030/pixelGameEngine.h b/Faceball2030/pixelGameEngine.h index 647c3f8..a15639a 100644 --- a/Faceball2030/pixelGameEngine.h +++ b/Faceball2030/pixelGameEngine.h @@ -2891,6 +2891,7 @@ namespace olc di.pos.resize(4); di.uv = { { 0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f} }; di.w = { 1, 1, 1, 1 }; + di.z = { 0,0,0,0 }; di.tint = { tint, tint, tint, tint }; di.points = 4; di.pos[0] = (olc::vf2d(0.0f, 0.0f) - center) * scale;