From ca3979011994250bcbbcb95fec45e71683178cf3 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Fri, 1 Sep 2023 17:59:44 -0500 Subject: [PATCH] Music deletion fix. Set a starting camera location for a level. --- olcCodeJam2023Entry/Info.txt | 15 +++++++++++---- olcCodeJam2023Entry/Level.h | 2 ++ olcCodeJam2023Entry/VirusAttack.cpp | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/olcCodeJam2023Entry/Info.txt b/olcCodeJam2023Entry/Info.txt index 52ae55f..edc66ac 100644 --- a/olcCodeJam2023Entry/Info.txt +++ b/olcCodeJam2023Entry/Info.txt @@ -77,8 +77,10 @@ Stage 2: Now select the memory allocator and let's make a Shifter unit. The memory shifters will be your way to delete memory from units. I have detected viruses in the system again. Please eradicate them and free system resources. +(New Scenario Objective: + -Defeat all enemy units) -Stage 2.5: +Stage 3: I haven't touched on what the other meters on your units are, but they are important. The Blue bits indicates movement capabilities of a unit. The Green bits indicates the range of a unit. @@ -87,8 +89,11 @@ Stage 2.5: As units attack each other, their bits are going to get shuffled around, impeding their ability to perform. Your immediate goal is to always take out the Yellow bits but sometimes taking out other bits is important too. I'll leave a guide by the map in case your memory betrays you. +(Guide Enabled) +(New Scenario Objective: + -Defeat all enemy units) -Stage 3: +Stage 4: (Start with 3 of the yellow resource) Hacker, I have unfortunate news. I can't supply you with any more bits to construct things with. You've only got 3 health bits to start with this time. To allocate memory you always need at least 5 bits of memory. @@ -101,8 +106,10 @@ Stage 3: An ambush...? I, WHAT? -- THIS IS NOT- Screen glitches out and fades away -Stage 4: - +Stage 5: +(New Scenario Objective: + -Defeat all enemy units) + diff --git a/olcCodeJam2023Entry/Level.h b/olcCodeJam2023Entry/Level.h index c6a77d0..4ac6d50 100644 --- a/olcCodeJam2023Entry/Level.h +++ b/olcCodeJam2023Entry/Level.h @@ -29,4 +29,6 @@ struct Level{ std::vectorunitPlacement; std::vectorcpPlacement; Sound bgm=Sound::COSMOS; + vf2d cameraStart={96,96}; + vf2d worldZoom={1,1}; }; \ No newline at end of file diff --git a/olcCodeJam2023Entry/VirusAttack.cpp b/olcCodeJam2023Entry/VirusAttack.cpp index fe71c5a..56b053d 100644 --- a/olcCodeJam2023Entry/VirusAttack.cpp +++ b/olcCodeJam2023Entry/VirusAttack.cpp @@ -154,15 +154,25 @@ void VirusAttack::LoadLevel(LevelName level){ WORLD_SIZE=selectedLevel.size; - if(bgm!=nullptr){ + game.SetWorldScale(selectedLevel.worldZoom); + game.SetWorldOffset(selectedLevel.cameraStart-vf2d(GetScreenSize())/2.f/game.GetWorldScale()); + + if(bgm==nullptr){ + bgm=SOUNDS[selectedLevel.bgm].get(); + bgm->PlayCentered(1,1,true); + } else + if(bgm!=SOUNDS[selectedLevel.bgm].get()){ bgm->Stop(); + bgm=SOUNDS[selectedLevel.bgm].get(); + bgm->PlayCentered(1,1,true); } - bgm=SOUNDS[selectedLevel.bgm].get(); - bgm->PlayCentered(1,1,true); player_resources=selectedLevel.player_starting_resources; enemy_resources=selectedLevel.enemy_starting_resources; TileManager::visibleTiles.clear(); + std::for_each(units.begin(),units.end(),[&](auto&u){ + u->OnDeath(SOUNDS); + }); units.clear(); collectionPoints.clear();