|
|
|
@ -6,8 +6,25 @@ using namespace olc; |
|
|
|
|
extern FaceBall* game; |
|
|
|
|
|
|
|
|
|
void Editor::Update(float fElapsedTime){ |
|
|
|
|
LoadLevelHandling(); |
|
|
|
|
vf2d center = { -(float)MAP_SIZE.x / 2 * GRID_SIZE.x + game->ScreenWidth()/2 , -(float)MAP_SIZE.y / 2 * GRID_SIZE.y + game->ScreenHeight()/2 }; |
|
|
|
|
if (game->GetMouseWheel() != 0) { |
|
|
|
|
if (game->GetMouseWheel() > 0) { |
|
|
|
|
if (selectedEnemy < 63) { |
|
|
|
|
selectedEnemy=EnemyID(selectedEnemy+1); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
selectedEnemy = EnemyID::NONE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
if (selectedEnemy > 0) { |
|
|
|
|
selectedEnemy = EnemyID(selectedEnemy - 1); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
selectedEnemy = AREA_MAP; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int y = 0; y < MAP_SIZE.y; y++) { |
|
|
|
|
for (int x = 0; x < MAP_SIZE.x; x++) { |
|
|
|
|
Tile&t = map[y][x]; |
|
|
|
@ -42,15 +59,36 @@ void Editor::Update(float fElapsedTime){ |
|
|
|
|
neighbor.wallE = t.wallW; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (game->GetMouse(0).bPressed) { |
|
|
|
|
t.enemyId = selectedEnemy; |
|
|
|
|
} |
|
|
|
|
if (game->GetMouse(1).bPressed) { |
|
|
|
|
t.enemyId = EnemyID::NONE; |
|
|
|
|
} |
|
|
|
|
game->FillRectDecal(squarePos, GRID_SIZE, { 0,0,255,64 }); |
|
|
|
|
} |
|
|
|
|
//game->DrawRectDecal(squarePos,GRID_SIZE,{64,64,64});
|
|
|
|
|
game->DrawLineDecal(squarePos,{squarePos.x+GRID_SIZE.x,squarePos.y},t.wallN?WHITE:Pixel{64,64,64}); |
|
|
|
|
game->DrawLineDecal({ squarePos.x + GRID_SIZE.x,squarePos.y }, { squarePos.x + GRID_SIZE.x,squarePos.y + GRID_SIZE.y }, t.wallE ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
game->DrawLineDecal({ squarePos.x + GRID_SIZE.x,squarePos.y + GRID_SIZE.y }, { squarePos.x,squarePos.y + GRID_SIZE.y }, t.wallS ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
game->DrawLineDecal({ squarePos.x,squarePos.y + GRID_SIZE.y }, squarePos, t.wallW ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
if (t.enemyId != EnemyID::NONE) { |
|
|
|
|
if (t.enemyId >= COIN) { |
|
|
|
|
game->DrawPolygonDecal(nullptr, { |
|
|
|
|
vf2d{0,(float) GRID_SIZE.y / 2} + squarePos , |
|
|
|
|
vf2d{(float)GRID_SIZE.x / 2,0} + squarePos , |
|
|
|
|
vf2d{(float)GRID_SIZE.x,(float)GRID_SIZE.y / 2} + squarePos , |
|
|
|
|
vf2d{(float)GRID_SIZE.x / 2,(float)GRID_SIZE.y} + squarePos , |
|
|
|
|
}, { {0,0},{0,0} ,{0,0} ,{0,0} }, game->GetData(t.enemyId).col); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
game->DrawDecal(squarePos, game->circle, { 1,1 }, game->GetData(t.enemyId).col); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
game->DrawLineDecal(squarePos,{squarePos.x+ (float)GRID_SIZE.x,squarePos.y},t.wallN?WHITE:Pixel{64,64,64}); |
|
|
|
|
game->DrawLineDecal({ squarePos.x + (float)GRID_SIZE.x,squarePos.y }, { squarePos.x + (float)GRID_SIZE.x,squarePos.y + (float)GRID_SIZE.y }, t.wallE ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
game->DrawLineDecal({ squarePos.x + (float)GRID_SIZE.x,squarePos.y + (float)GRID_SIZE.y }, { squarePos.x,squarePos.y + (float)GRID_SIZE.y }, t.wallS ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
game->DrawLineDecal({ squarePos.x,squarePos.y + (float)GRID_SIZE.y }, squarePos, t.wallW ? WHITE : Pixel{ 64,64,64 }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
game->DrawStringDecal({ 2,16 }, "Selected Enemy ("+std::to_string(selectedEnemy) + "): " + game->GetData(selectedEnemy).name, WHITE, {3,3}); |
|
|
|
|
LoadLevelHandling(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Editor::LoadLevelHandling() { |
|
|
|
@ -61,6 +99,7 @@ void Editor::LoadLevelHandling() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
game->FillRectDecal({ 0,0 }, { (float)game->ScreenWidth(),32 }, BLACK); |
|
|
|
|
game->DrawStringDecal({ 0,0 }, "Enter Level (1-30): " + game->TextEntryGetString(), WHITE, { 4,4 }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|