From 86121c9da8f059d46d6ab7b88bf9d59e43116170 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Fri, 1 Sep 2023 23:18:29 -0500 Subject: [PATCH] Increment/Decrement lerp indicators. Added memory usage bar. --- olcCodeJam2023Entry/Constant.cpp | 5 +- olcCodeJam2023Entry/Constant.h | 3 + olcCodeJam2023Entry/Image.h | 2 + olcCodeJam2023Entry/Info.txt | 9 +- olcCodeJam2023Entry/Level.h | 5 + olcCodeJam2023Entry/Unit.cpp | 23 +-- olcCodeJam2023Entry/VirusAttack.cpp | 179 +++++++++++++++++- olcCodeJam2023Entry/VirusAttack.h | 16 +- olcCodeJam2023Entry/assets/round_bar.png | Bin 0 -> 576 bytes olcCodeJam2023Entry/assets/round_bar_left.png | Bin 0 -> 570 bytes olcCodeJam2023Entry/assets/segmentBar.png | Bin 0 -> 577 bytes 11 files changed, 216 insertions(+), 26 deletions(-) create mode 100644 olcCodeJam2023Entry/assets/round_bar.png create mode 100644 olcCodeJam2023Entry/assets/round_bar_left.png create mode 100644 olcCodeJam2023Entry/assets/segmentBar.png diff --git a/olcCodeJam2023Entry/Constant.cpp b/olcCodeJam2023Entry/Constant.cpp index 795dd24..0b45008 100644 --- a/olcCodeJam2023Entry/Constant.cpp +++ b/olcCodeJam2023Entry/Constant.cpp @@ -35,4 +35,7 @@ int CONSTANT::STARTING_RESOURCE_COUNT=5; Pixel CONSTANT::MESSAGE_BOX_DEFAULT_BACKCOL=VERY_DARK_GREEN; std::string CONSTANT::MEMORY_ALLOCATOR_BOX_DISPLAY_STRING="Creates a memory allocator, which are used for making new units.\n\nCosts 5 resources."; -std::string CONSTANT::MEMORY_ALLOCATOR_BOX_HEADER_STRING="Memory Allocator"; \ No newline at end of file +std::string CONSTANT::MEMORY_ALLOCATOR_BOX_HEADER_STRING="Memory Allocator"; + +Pixel CONSTANT::INCREASE_VALUE_COLOR={7, 223, 247}; +Pixel CONSTANT::DECREASE_VALUE_COLOR={201, 30, 30}; \ No newline at end of file diff --git a/olcCodeJam2023Entry/Constant.h b/olcCodeJam2023Entry/Constant.h index 397bbc9..58a2745 100644 --- a/olcCodeJam2023Entry/Constant.h +++ b/olcCodeJam2023Entry/Constant.h @@ -40,4 +40,7 @@ public: static Pixel MESSAGE_BOX_DEFAULT_BACKCOL; static std::string MEMORY_ALLOCATOR_BOX_DISPLAY_STRING; static std::string MEMORY_ALLOCATOR_BOX_HEADER_STRING; + + static Pixel INCREASE_VALUE_COLOR; + static Pixel DECREASE_VALUE_COLOR; }; \ No newline at end of file diff --git a/olcCodeJam2023Entry/Image.h b/olcCodeJam2023Entry/Image.h index 4be69f3..28a8a4b 100644 --- a/olcCodeJam2023Entry/Image.h +++ b/olcCodeJam2023Entry/Image.h @@ -38,5 +38,7 @@ enum Image{ PLATFORM, GUARD_ICON, GUIDE, + ROUND_BAR, + SEGMENT_BAR, }; diff --git a/olcCodeJam2023Entry/Info.txt b/olcCodeJam2023Entry/Info.txt index 54fc4a8..9b8d8ed 100644 --- a/olcCodeJam2023Entry/Info.txt +++ b/olcCodeJam2023Entry/Info.txt @@ -128,7 +128,14 @@ Stage 8: (New Scenario Objective: -Defeat all enemy units) - +Distribution of Collection Points: +HEALTH 60 +ATKSPD 21 +MOVESPD 28 +RANGE 20 +PROCEDURE 81 + +Roughly 3 : 1 : 1.5 : 1 : 4 ratio Potential Songs: 1 Pixel diff --git a/olcCodeJam2023Entry/Level.h b/olcCodeJam2023Entry/Level.h index cdcba13..3f58e1c 100644 --- a/olcCodeJam2023Entry/Level.h +++ b/olcCodeJam2023Entry/Level.h @@ -26,6 +26,10 @@ struct CPData{ MemoryType type; }; +//A small level will allocate roughly 640 bits +//Medium: 960 +//Large: 1280 + struct Level{ vi2d size={1,1}; Resources player_starting_resources; @@ -36,4 +40,5 @@ struct Level{ vf2d cameraStart={96,96}; vf2d worldZoom={1,1}; Pixel levelColor=DARK_GREEN; + int availableMemory=640; }; \ No newline at end of file diff --git a/olcCodeJam2023Entry/Unit.cpp b/olcCodeJam2023Entry/Unit.cpp index 3448030..6719ef0 100644 --- a/olcCodeJam2023Entry/Unit.cpp +++ b/olcCodeJam2023Entry/Unit.cpp @@ -8,7 +8,7 @@ std::string LeftShifter::unitName="Left Shifter"; std::string LeftShifter::unitDescription="Shifts target memory 1 bit to the left."; -std::vector LeftShifter::resourceCost={{RANGE,2},{ATKSPD,2},{MOVESPD,3},{PROCEDURE,1},{HEALTH,4}}; +std::vector LeftShifter::resourceCost={{RANGE,2},{ATKSPD,2},{MOVESPD,6},{PROCEDURE,1},{HEALTH,4}}; LeftShifter::LeftShifter(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,LeftShifter::resourceCost,pos,12,*IMAGES[LEFT_SHIFTER],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,moveable){} @@ -18,7 +18,7 @@ void LeftShifter::Attack(Unit&victim,std::vector>&otherUni std::string RightShifter::unitName="Right Shifter"; std::string RightShifter::unitDescription="Shifts target memory 1 bit to the right."; -std::vector RightShifter::resourceCost={{HEALTH,4},{RANGE,2},{ATKSPD,2},{MOVESPD,3},{PROCEDURE,1}}; +std::vector RightShifter::resourceCost={{HEALTH,4},{RANGE,2},{ATKSPD,2},{MOVESPD,6},{PROCEDURE,1}}; RightShifter::RightShifter(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,RightShifter::resourceCost,pos,12,*IMAGES[RIGHT_SHIFTER],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,moveable){} @@ -28,7 +28,7 @@ void RightShifter::Attack(Unit&victim,std::vector>&otherUn std::string BitRestorer::unitName="Bit Restorer"; std::string BitRestorer::unitDescription="Randomly restores 1 missing bit to a target."; -std::vector BitRestorer::resourceCost={{PROCEDURE,6},{RANGE,1},{ATKSPD,1},{MOVESPD,1},{HEALTH,2}}; +std::vector BitRestorer::resourceCost={{PROCEDURE,6},{RANGE,1},{ATKSPD,1},{MOVESPD,2},{HEALTH,2}}; BitRestorer::BitRestorer(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,BitRestorer::resourceCost,pos,12,*IMAGES[BIT_RESTORER],CONSTANT::HEALER_TARGET_COL,CONSTANT::HEALER_ATTACK_COL,friendly,moveable,true,false){} @@ -70,7 +70,7 @@ void BitRestorer::AttemptToHealOtherAllies(std::vector>&ot std::string MemorySwapper::unitName="Memory Swapper"; std::string MemorySwapper::unitDescription="Flips the orientation of all bits of a target around."; -std::vector MemorySwapper::resourceCost={{RANGE,3},{ATKSPD,1},{HEALTH,3},{PROCEDURE,3},{MOVESPD,2}}; +std::vector MemorySwapper::resourceCost={{RANGE,3},{ATKSPD,1},{HEALTH,3},{PROCEDURE,3},{MOVESPD,4}}; MemorySwapper::MemorySwapper(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,MemorySwapper::resourceCost,pos,12,*IMAGES[MEMORY_SWAPPER],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,moveable,true){ autoAcquireFriendlyTarget=false; @@ -114,7 +114,7 @@ void MemorySwapper::Attack(Unit&victim,std::vector>&otherU std::string Corrupter::unitName="Corrupter"; std::string Corrupter::unitDescription="Chooses a random bit and negates it on a target."; -std::vector Corrupter::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,4},{HEALTH,4}}; +std::vector Corrupter::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,8},{HEALTH,4}}; Corrupter::Corrupter(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,Corrupter::resourceCost,pos,12,*IMAGES[CORRUPTER],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,moveable){} @@ -126,7 +126,7 @@ void Corrupter::Attack(Unit&victim,std::vector>&otherUnits std::string MemoryAllocator::unitName="Memory Allocator"; std::string MemoryAllocator::unitDescription="A unit that builds other units."; -std::vector MemoryAllocator::resourceCost={{RANGE,1},{ATKSPD,1},{MOVESPD,1},{PROCEDURE,1},{HEALTH,1}}; +std::vector MemoryAllocator::resourceCost={{RANGE,1},{ATKSPD,1},{MOVESPD,2},{PROCEDURE,1},{HEALTH,1}}; MemoryAllocator::MemoryAllocator(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,MemoryAllocator::resourceCost,pos,12,*IMAGES[UNIT_ALLOCATOR],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,true,false){ isAllocator=true; @@ -327,7 +327,7 @@ void _Platform::Draw(TileTransformedView&game,std::map Refresher::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,4},{HEALTH,4}}; +std::vector Refresher::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{HEALTH,4}}; Refresher::Refresher(PixelGameEngine*pge,vf2d pos,std::map>&IMAGES,bool friendly,bool moveable) :Unit(pge,Refresher::resourceCost,pos,24,*IMAGES[REFRESHER],CONSTANT::ATTACKER_TARGET_COL,CONSTANT::ATTACKER_ATTACK_COL,friendly,false ,true,false){} @@ -643,14 +643,14 @@ void Unit::_Update(PixelGameEngine*pge,std::map>&SO if(!target.expired()){ auto ptrTarget=target.lock(); if(!InRange(ptrTarget)&&CanMove()){ - SetPos(GetPos()+(ptrTarget->GetPos()-pos).norm()*GetMoveSpd()*24*pge->GetElapsedTime()); + SetPos(GetPos()+(ptrTarget->GetPos()-pos).norm()*GetMoveSpd()*12*pge->GetElapsedTime()); } } else if(targetLoc!=CONSTANT::UNSELECTED){ float dist=geom2d::line(pos,targetLoc).length(); if(dist>24){ if(CanMove()){ - SetPos(GetPos()+(targetLoc-pos).norm()*GetMoveSpd()*24*pge->GetElapsedTime()); + SetPos(GetPos()+(targetLoc-pos).norm()*GetMoveSpd()*12*pge->GetElapsedTime()); } } else { if(willAttachWhenReachingDestination&&!attachTarget.expired()&&attachTarget.lock()->attachedUnit.expired()){ @@ -670,23 +670,18 @@ void Unit::_Update(PixelGameEngine*pge,std::map>&SO switch(attachedPoint.lock()->type){ case HEALTH:{ targetResource.health++; - resourceGainTimer[0]=2; }break; case RANGE:{ targetResource.range++; - resourceGainTimer[3]=2; }break; case ATKSPD:{ targetResource.atkSpd++; - resourceGainTimer[1]=2; }break; case MOVESPD:{ targetResource.moveSpd++; - resourceGainTimer[2]=2; }break; case PROCEDURE:{ targetResource.procedure++; - resourceGainTimer[4]=2; }break; } resourceGainIcons.push_back({IMAGES[RESOURCE].get(),attachedPoint.lock()->type,GetPos()}); diff --git a/olcCodeJam2023Entry/VirusAttack.cpp b/olcCodeJam2023Entry/VirusAttack.cpp index 6d16c87..f7747f6 100644 --- a/olcCodeJam2023Entry/VirusAttack.cpp +++ b/olcCodeJam2023Entry/VirusAttack.cpp @@ -61,6 +61,8 @@ void VirusAttack::InitializeImages(){ LoadImage(PLATFORM,"assets/platform.png"); LoadImage(GUARD_ICON,"assets/shieldIcon.png"); LoadImage(GUIDE,"assets/guide.png"); + LoadImage(ROUND_BAR,"assets/round_bar.png"); + LoadImage(SEGMENT_BAR,"assets/segmentBar.png",false,false); } void VirusAttack::InitializeLevelData(){ @@ -73,7 +75,7 @@ void VirusAttack::InitializeLevelData(){ levelData[stage].levelColor=DARK_RED; levelData[stage].size={64,64}; levelData[stage].bgm=Sound::BOSS2; - levelData[stage].player_starting_resources={50,50,50,50,50}; + levelData[stage].player_starting_resources={500,500,500,500,500}; levelData[stage].enemy_starting_resources={0,0,0,0,0}; { std::vector&units=levelData[stage].unitPlacement; @@ -127,6 +129,7 @@ void VirusAttack::InitializeLevelData(){ } bool VirusAttack::OnUserCreate(){ + srand(time(NULL)); SetPixelMode(Pixel::MASK); game.Initialise(GetScreenSize()); @@ -667,6 +670,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ std::erase_if(TileManager::visibleTiles,[](std::pair key){return key.second<=0;}); + playerUsedMemory=enemyUsedMemory={0}; for(auto&u:units){ u->SaveMemory(); std::weak_ptrclosestUnit; @@ -686,6 +690,19 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ } u->AttemptAttack(u,closestUnit,units,debuffIcons,IMAGES); u->_Update(this,SOUNDS,player_resources,enemy_resources,queuedUnits,resourceGainTimer,resourceGainIcons,IMAGES); + if(u->IsFriendly()){ + playerUsedMemory[0]+=u->health.size; + playerUsedMemory[1]+=u->range.size; + playerUsedMemory[2]+=u->atkSpd.size; + playerUsedMemory[3]+=u->moveSpd.size; + playerUsedMemory[4]+=u->procedure.size; + } else { + enemyUsedMemory[0]+=u->health.size; + enemyUsedMemory[1]+=u->range.size; + enemyUsedMemory[2]+=u->atkSpd.size; + enemyUsedMemory[3]+=u->moveSpd.size; + enemyUsedMemory[4]+=u->procedure.size; + } } std::erase_if(units,[&](std::shared_ptru){ @@ -704,7 +721,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ queuedUnits.clear(); - DrawPartialDecal({0,0},GetScreenSize(),IMAGES[MATRIX]->Decal(),randomBackgroundOffset,{32,32},Pixel{currentLevel->levelColor.r,currentLevel->levelColor.g,currentLevel->levelColor.b,164}/2); + DrawPartialDecal({0,0},GetScreenSize(),IMAGES[MATRIX]->Decal(),randomBackgroundOffset+game.GetWorldOffset()*(vf2d{32,32}/vf2d(GetScreenSize()))*game.GetWorldScale(),{32,32},Pixel{currentLevel->levelColor.r,currentLevel->levelColor.g,currentLevel->levelColor.b,164}/2); game.DrawPartialDecal({0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,IMAGES[TILE]->Decal(),{0,0},WORLD_SIZE*CONSTANT::TILE_SIZE,currentLevel->levelColor); for(auto&u:units){ @@ -756,6 +773,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ unitCreationList.DrawDecal(this); platformCreationList.DrawDecal(this); + DrawSystemMemoryBar(fElapsedTime); DrawResourceBar(fElapsedTime); DrawDecal({float(ScreenWidth()-74-IMAGES[GUIDE]->Sprite()->width*0.75),float(ScreenHeight()+6-IMAGES[GUIDE]->Sprite()->height*0.75)},IMAGES[GUIDE]->Decal(),{0.75,0.75}); DrawMinimap(); @@ -789,21 +807,146 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ return true; } +void VirusAttack::DrawSystemMemoryBar(float fElapsedTime){ + memoryChangeTimer=std::max(0.f,memoryChangeTimer-fElapsedTime); + memoryDisplayDelay-=fElapsedTime; + if(memoryDisplayDelay<=0){ + if(memoryDisplayAmt>lastTotalMemory){ + memoryDisplayAmt-=1; + } else + if(memoryDisplayAmtplayerUsedDisplayMemory[i]){ + playerUsedDisplayMemory[i]++; + } + } + for(int i=0;ienemyUsedDisplayMemory[i]){ + enemyUsedDisplayMemory[i]++; + } + } + lastDisplayMemoryUpdateTimer=0.01; + } + + vf2d barPos={2,float(ScreenHeight()-7)}; + float barOffset=0; + float barWidth=240; + float actualBarWidth=barWidth+2; + for(int i=0;iavailableMemory)*actualBarWidth; + Pixel col; + switch(i){ + case 0:{ + col=CONSTANT::HEALTH_COLOR; + }break; + case 1:{ + col=CONSTANT::RANGE_COLOR; + }break; + case 2:{ + col=CONSTANT::ATKSPD_COLOR; + }break; + case 3:{ + col=CONSTANT::MOVESPD_COLOR; + }break; + case 4:{ + col=CONSTANT::PROCEDURE_COLOR; + }break; + } + DrawPartialDecal(barPos+vf2d{barOffset+1,1.f},{barSegmentWidth,3},IMAGES[SEGMENT_BAR]->Decal(),{0,0},{float(playerUsedDisplayMemory[i]),3.f},col); + barOffset+=barSegmentWidth; + } + FillRectDecal(barPos+vf2d{barOffset+1,1.f},{2,3},GREEN); + barOffset=0; + for(int i=0;iavailableMemory)*actualBarWidth; + Pixel col; + switch(i){ + case 0:{ + col=CONSTANT::HEALTH_COLOR; + }break; + case 1:{ + col=CONSTANT::RANGE_COLOR; + }break; + case 2:{ + col=CONSTANT::ATKSPD_COLOR; + }break; + case 3:{ + col=CONSTANT::MOVESPD_COLOR; + }break; + case 4:{ + col=CONSTANT::PROCEDURE_COLOR; + }break; + } + DrawPartialDecal(barPos+vf2d{barOffset+actualBarWidth+3-barSegmentWidth,1.f},{barSegmentWidth,3},IMAGES[SEGMENT_BAR]->Decal(),{0,0},{float(enemyUsedDisplayMemory[i]),3.f},col); + barOffset-=barSegmentWidth; + } + FillRectDecal(barPos+vf2d{barOffset+actualBarWidth+3-2,1.f},{2,3},RED); + + DrawPartialDecal(barPos,{3,5},IMAGES[ROUND_BAR]->Decal(),{0,0},{3,5}); + for(int i=barPos.x+3;iDecal(),{2,0},{1,5}); + } + DrawPartialDecal(barPos+vf2d{3+barWidth,0},{3,5},IMAGES[ROUND_BAR]->Decal(),{2,0},{3,5}); + vf2d textPos=barPos+vf2d{barWidth+6+4,0}; + if(GetTotalUsedMemory()>lastTotalMemory){ + memoryIncreased=true; + memoryChangeTimer=2; + } else + if(GetTotalUsedMemory()availableMemory)+"b",WHITE,PixelLerp(BLACK,memoryIncreased?CONSTANT::INCREASE_VALUE_COLOR:CONSTANT::DECREASE_VALUE_COLOR,memoryChangeTimer/2.0f),{0.6,0.6},0.6); +} + void VirusAttack::DrawResourceBar(float fElapsedTime){ for(int i=0;iresourceValue){ + resourceIncreased[index]=false; + resourceGainTimer[index]=2; + previousResourceValue=resourceValue; + } + if(resourceDisplayValueUpdateTimer[index]<=0){ + if(displayResourceValueresourceValue){ + displayResourceValue--; + } + resourceDisplayValueUpdateTimer[index]=0.01; + } DrawDecal({6.f+index*42,1.f},IMAGES[RESOURCE]->Decal(),{1,1},col); - DrawShadowStringDecal({6.f+index*42+20,2.f},std::to_string(resourceValue),col,PixelLerp(BLACK,{7, 223, 247},resourceGainTimer[index]/2.0f)); + DrawShadowStringDecal({6.f+index*42+20,2.f},std::to_string(displayResourceValue),col,PixelLerp(BLACK,resourceIncreased[index]?CONSTANT::INCREASE_VALUE_COLOR:CONSTANT::DECREASE_VALUE_COLOR,resourceGainTimer[index]/2.0f)); }; - DrawResourceDisplay(0,player_resources.health,CONSTANT::HEALTH_COLOR); - DrawResourceDisplay(1,player_resources.atkSpd,CONSTANT::ATKSPD_COLOR); - DrawResourceDisplay(2,player_resources.moveSpd,CONSTANT::MOVESPD_COLOR); - DrawResourceDisplay(3,player_resources.range,CONSTANT::RANGE_COLOR); - DrawResourceDisplay(4,player_resources.procedure,CONSTANT::PROCEDURE_COLOR); + DrawResourceDisplay(0,player_resources.health,player_prev_resources.health,player_display_resources.health,CONSTANT::HEALTH_COLOR); + DrawResourceDisplay(1,player_resources.atkSpd,player_prev_resources.atkSpd,player_display_resources.atkSpd,CONSTANT::ATKSPD_COLOR); + DrawResourceDisplay(2,player_resources.moveSpd,player_prev_resources.moveSpd,player_display_resources.moveSpd,CONSTANT::MOVESPD_COLOR); + DrawResourceDisplay(3,player_resources.range,player_prev_resources.range,player_display_resources.range,CONSTANT::RANGE_COLOR); + DrawResourceDisplay(4,player_resources.procedure,player_prev_resources.procedure,player_display_resources.procedure,CONSTANT::PROCEDURE_COLOR); } void VirusAttack::RenderFogOfWar(){ @@ -863,6 +1006,24 @@ void VirusAttack::ExpendResources(Resources&resources,std::vector&unitCo } } +int VirusAttack::GetTotalUsedMemory(){ + return GetPlayerUsedMemory()+GetEnemyUsedMemory(); +} +int VirusAttack::GetPlayerUsedMemory(){ + int sum=0; + for(int i=0;i<5;i++){ + sum+=playerUsedMemory[i]; + } + return sum; +} +int VirusAttack::GetEnemyUsedMemory(){ + int sum=0; + for(int i=0;i<5;i++){ + sum+=enemyUsedMemory[i]; + } + return sum; +} + int main() { VirusAttack app; diff --git a/olcCodeJam2023Entry/VirusAttack.h b/olcCodeJam2023Entry/VirusAttack.h index 2db3e91..7f80a27 100644 --- a/olcCodeJam2023Entry/VirusAttack.h +++ b/olcCodeJam2023Entry/VirusAttack.h @@ -42,7 +42,7 @@ private: olcPGEX_AudioListener AL; Audio*bgm=nullptr; - Resources player_resources,enemy_resources; + Resources player_resources,player_prev_resources,player_display_resources,enemy_resources; TileTransformedView game; @@ -69,6 +69,16 @@ private: const std::arraymatrixLetters={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',}; std::vectoractiveLetters; std::arrayresourceGainTimer={0}; + std::arrayresourceDisplayValueUpdateTimer={0}; + std::arrayresourceIncreased={false}; + std::arrayplayerUsedMemory={0},enemyUsedMemory={0}; + std::arrayplayerUsedDisplayMemory={0},enemyUsedDisplayMemory={0}; + float lastDisplayMemoryUpdateTimer=0; + int lastTotalMemory=0; + int memoryDisplayAmt=0; + float memoryDisplayDelay=0; + bool memoryIncreased=true; + float memoryChangeTimer=2; vf2d randomBackgroundOffset; @@ -96,6 +106,10 @@ private: void LoadLevel(LevelName level); void InitializeLevelData(); void UpdatePlatformCreationListGUI(bool platformSelected); + int GetTotalUsedMemory(); + int GetPlayerUsedMemory(); + int GetEnemyUsedMemory(); + void DrawSystemMemoryBar(float fElapsedTime); public: VirusAttack(); diff --git a/olcCodeJam2023Entry/assets/round_bar.png b/olcCodeJam2023Entry/assets/round_bar.png new file mode 100644 index 0000000000000000000000000000000000000000..7e6bdfc1659839e5505af8c7659e3767271225f5 GIT binary patch literal 576 zcmV-G0>AxEX>4Tx04R}tkvm8OK@>%gQSpOfVG0q8E!0XI6_HdSia{_SF@nFs-HnNX>?Z6c z*jNg-0SiBkzrw~^TMJu35d47H+E^*th^%jtK!O+thB@4s`*`mT_zu&ia>eP8VsA|=I_vdPluev7GX~ID>>*R!2gh$tN zS;f1;esfKa3!e!OIMSf-gVK!>zbZ}^Sv8H{iABeS{lZ$Zij68Z*BncDM7TF@*;3y( zU*fpp4aHVEZyk_jTlX-^Wn@1ebQjpE-oF577%1 zt@i*rHsSoLq8U4Iu?1a^S>4f#QoU?nA^~rw@=XiSc>}FWrQFK*oZLf9vYNhzy?y9U zO6}zub2nG#_V1f=en0pCa@;7uVut_#00v@9M??Tc07U>r8Ml^l00009a7bBm001r{ z001r{0eGc9b^rhX2XskIMF-~z0s#Os-ku;q0000PbVXQnLvL+uWo~o;Lvm$dbY)~9 zcWHEJAV*0}P*;Ht7XSbN8c9S!R0!8&U_gNX3~1m#y2O7R3NTe-r~m+#;0O6!zNORv O0000%A_P)EX>4Tx04R}tkvm8OK@>%gQSpOfVG0q8E!0XI6_HdSia{_SF@nFs-HnNX>?Z6c z*jNg-0SiBkzrw~^TMJu35d47H+E^*th^%jtK!O+thB@4s`*`mT_zu&ia>eP8VsA|=I_vdPluev7GX~ID>>*R!2gh$tN zS;f1;esfKa3!e!OIMSf-gVK!>zbZ}^Sv8H{iABeS{lZ$Zij68Z*BncDM7TF@*;3y( zU*fpp4aHVEZyk_jTlX-^Wn@1ebQjpE-oF577%1 zt@i*rHsSoLq8U4Iu?1a^S>4f#QoU?nA^~rw@=XiSc>}FWrQFK*oZLf9vYNhzy?y9U zO6}zub2nG#_V1f=en0pCa@;7uVut_#00v@9M??Tc07U>r8Ml^l00009a7bBm001r{ z001r{0eGc9b^rhX2XskIMF-~z0suQZ?KLfY0000PbVXQnLvL+uWo~o;Lvm$dbY)~9 zcWHEJAV*0}P*;Ht7XSbN6iGxuR0!8&WI%xb3`B7-1R2o<0n+FM{#OzY@&Et;07*qo IM6N<$f;&3vfdBvi literal 0 HcmV?d00001 diff --git a/olcCodeJam2023Entry/assets/segmentBar.png b/olcCodeJam2023Entry/assets/segmentBar.png new file mode 100644 index 0000000000000000000000000000000000000000..d6bb8bb44ec4053326b61fdbac92d6a75df1e579 GIT binary patch literal 577 zcmV-H0>1r;P)EX>4Tx04R}tkvm8OK@>%gQSpOfVG0q8E!0XI6_HdSia{_SF@nFs-HnNX>?Z6c z*jNg-0SiBkzrw~^TMJu35d47H+E^*th^%jtK!O+thB@4s`*`mT_zu&ia>eP8VsA|=I_vdPluev7GX~ID>>*R!2gh$tN zS;f1;esfKa3!e!OIMSf-gVK!>zbZ}^Sv8H{iABeS{lZ$Zij68Z*BncDM7TF@*;3y( zU*fpp4aHVEZyk_jTlX-^Wn@1ebQjpE-oF577%1 zt@i*rHsSoLq8U4Iu?1a^S>4f#QoU?nA^~rw@=XiSc>}FWrQFK*oZLf9vYNhzy?y9U zO6}zub2nG#_V1f=en0pCa@;7uVut_#00v@9M??Ss00000`9r&Z00009a7bBm001r{ z001r{0eGc9b^rhX2XskIMF-~z0s;y+vE{EC0000PbVXQnLvL+uWo~o;Lvm$dbY)~9 zcWHEJAV*0}P*;Ht7XSbN8%ab#R0!8&T)lere+B|z$BrEgObkQ