From 223e26afe5909051af51d4ab2a87c20eea7b4674 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Fri, 1 Sep 2023 17:36:27 -0500 Subject: [PATCH] Added guide plus resource indicator increase highlighting. --- olcCodeJam2023Entry/Image.h | 1 + olcCodeJam2023Entry/Info.txt | 69 ++++++++++++++++++++++++++- olcCodeJam2023Entry/Unit.cpp | 19 ++++---- olcCodeJam2023Entry/Unit.h | 2 +- olcCodeJam2023Entry/VirusAttack.cpp | 14 ++++-- olcCodeJam2023Entry/VirusAttack.h | 3 +- olcCodeJam2023Entry/assets/guide.png | Bin 0 -> 1267 bytes 7 files changed, 92 insertions(+), 16 deletions(-) create mode 100644 olcCodeJam2023Entry/assets/guide.png diff --git a/olcCodeJam2023Entry/Image.h b/olcCodeJam2023Entry/Image.h index 88c5357..4be69f3 100644 --- a/olcCodeJam2023Entry/Image.h +++ b/olcCodeJam2023Entry/Image.h @@ -37,5 +37,6 @@ enum Image{ TURRET, PLATFORM, GUARD_ICON, + GUIDE, }; diff --git a/olcCodeJam2023Entry/Info.txt b/olcCodeJam2023Entry/Info.txt index 78ca2d6..52ae55f 100644 --- a/olcCodeJam2023Entry/Info.txt +++ b/olcCodeJam2023Entry/Info.txt @@ -34,11 +34,78 @@ Day 6 Multiple Levels Day 7 Scenario Writing Hotkeys Day 8 Scenario Writing -Fake allies the narrator forgot to switch ovr +Fake allies the narrator forgot to switch over (Customized Units...?) Day 9 Sounds/Music/Menus - Timer (Speedrun) Difficulty Selection Ending...Shows Four Seasons of Loneliness boss zoom out... +Easy Difficulty: AI generate no new resources. +Normal Difficulty: AI generates resources at normal rate. +Hard Difficulty: AI generates resources at x4 rate. + + +Stage 1: +(All unit meters start greyed out) +(Disable left/right click and screen movement) + Hello Hacker, thank you for taking on this request for me. + It appears we have no time to waste, most sectors are already infected and it will just keep getting worse over time. + [Pan over to target enemy RAM bank] + Your mission is to take out all the RAM banks from the system, this will stop any further creation and spread of viruses. + [Pan over to left shifter unit] + (Yellow unit meters color in) + The yellow bar represent a unit's Health memory allocation. Make sure there's always at least 1 bit of it. + + (Simulate dragging over unit and selection) + Highlight over your target unit and then select a target location via right-click. + + That should be all you need for now. I'll be back after my coffee break. + + (New Scenario Objective: + -Defeat the RAM bank) + +Stage 2: +(Hide other Platform unit selections) + You took care of that sector flawlessly Hacker, this next one needs a bit more hand-holding. + We have analyzed the data from the RAM bank to reconstruct our own. Go ahead and select the Platform here and construct one. +(After constructing RAM bank) + Excellent, each RAM bank has the capability to allocate memory into the system. See that indicator down below? +(Highlight the memory allocator bar) + This sector lets us allocate 30 bytes of RAM. That's 240 bits for the savvy folks out there. + Some of it has already been used up by our RAM bank and other system resources... + To allocate 5 bits select the RAM bank and click the Memory Allocator button. +(Upon creating a memory allocator...) + 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. + +Stage 2.5: + 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. + The Red bits are the attack speed bits. + And Purple are the Procedure bits. Without these, your unit will fail to recall how to function. + 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. + +Stage 3: +(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. +[Pan over to a collection point] + But we can collect bits from the system using these collection points. + Simply bring over any unit to these and attach them to it. They will start providing you with system resources to make what you need. +(After attaching a unit to a collection point...) +2 Left shifters wander into the area. +[Pan over to the RAM bank] +An ambush...? I, WHAT? -- THIS IS NOT- +Screen glitches out and fades away + +Stage 4: + + + + Tutorial (Grey out non-important bars) diff --git a/olcCodeJam2023Entry/Unit.cpp b/olcCodeJam2023Entry/Unit.cpp index d77d90e..8ee2503 100644 --- a/olcCodeJam2023Entry/Unit.cpp +++ b/olcCodeJam2023Entry/Unit.cpp @@ -7,7 +7,7 @@ #include "Textbox.h" std::string LeftShifter::unitName="Left Shifter"; -std::string LeftShifter::unitDescription="Memory Shifts target memory 1 bit to the left."; +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}}; 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){} @@ -17,7 +17,7 @@ void LeftShifter::Attack(Unit&victim,std::vector>&otherUni } std::string RightShifter::unitName="Right Shifter"; -std::string RightShifter::unitDescription="Memory Shifts target memory 1 bit to the right."; +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}}; 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){} @@ -338,7 +338,7 @@ void Refresher::Attack(Unit&victim,std::vector>&otherUnits int attempts=0; while(attemptsGetMemorySize(); - if(u->memory[randomBit]){ + if(!u->memory[randomBit]){ u->memory[randomBit]=true; return; } @@ -400,7 +400,7 @@ void MemoryGuard::Attack(Unit&victim,std::vector>&otherUni } Unit::Unit(PixelGameEngine*pge,std::vectormemory,vf2d pos,float radius,Renderable&img,Pixel targetLineColor,Pixel attackingLineColor,bool friendly,bool moveable,bool friendlyInteractable,bool enemyInteractable) -:pos(pos),radius(radius),ghostPos(pos),img(img),targetLineCol(targetLineColor),attackingLineCol(attackingLineColor),friendly(friendly),moveable(moveable),friendlyInteractable(friendlyInteractable),enemyInteractable(enemyInteractable){ + :pos(pos),radius(radius),ghostPos({-999999,-999999}),img(img),targetLineCol(targetLineColor),attackingLineCol(attackingLineColor),friendly(friendly),moveable(moveable),friendlyInteractable(friendlyInteractable),enemyInteractable(enemyInteractable){ int marker=0; for(Memory&mem:memory){ for(int i=0;i>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector>&queuedUnits){ +void Unit::_Update(PixelGameEngine*pge,std::map>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector>&queuedUnits,std::array&resourceGainTimer){ if(!target.expired()){ auto ptrTarget=target.lock(); if(!InRange(ptrTarget)&&CanMove()){ @@ -668,18 +668,23 @@ 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; } } @@ -694,6 +699,7 @@ void Unit::_Update(PixelGameEngine*pge,std::map>&SO } if(!InFogOfWar()){ + ghostPos=pos; ghostMemory=memory; } @@ -782,9 +788,6 @@ bool Unit::InRange(vf2d pos){ void Unit::SetPos(vf2d newPos){ pos=newPos; - if(!InFogOfWar()){ - ghostPos=pos; - } } void Unit::AttemptAttack(std::weak_ptrattacker,std::weak_ptrunit,std::vector>&otherUnits,std::vector&debuffIcons,std::map>&IMAGES){ diff --git a/olcCodeJam2023Entry/Unit.h b/olcCodeJam2023Entry/Unit.h index 8cde212..d3bc9aa 100644 --- a/olcCodeJam2023Entry/Unit.h +++ b/olcCodeJam2023Entry/Unit.h @@ -71,7 +71,7 @@ public: bool GhostInFogOfWar(); void HideGhost(); vf2d GetGhostPos(); - void _Update(PixelGameEngine*pge,std::map>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector>&queuedUnits); + void _Update(PixelGameEngine*pge,std::map>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector>&queuedUnits,std::array&resourceGainTimer); bool IsMoveable(); void DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std::map>&IMAGES); bool CanInteractWithEnemies(); diff --git a/olcCodeJam2023Entry/VirusAttack.cpp b/olcCodeJam2023Entry/VirusAttack.cpp index b3917af..fe71c5a 100644 --- a/olcCodeJam2023Entry/VirusAttack.cpp +++ b/olcCodeJam2023Entry/VirusAttack.cpp @@ -60,6 +60,7 @@ void VirusAttack::InitializeImages(){ LoadImage(TURRET,"assets/turret.png"); LoadImage(PLATFORM,"assets/platform.png"); LoadImage(GUARD_ICON,"assets/shieldIcon.png"); + LoadImage(GUIDE,"assets/guide.png"); } void VirusAttack::InitializeLevelData(){ @@ -636,7 +637,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ } } u->AttemptAttack(u,closestUnit,units,debuffIcons,IMAGES); - u->_Update(this,SOUNDS,player_resources,enemy_resources,queuedUnits); + u->_Update(this,SOUNDS,player_resources,enemy_resources,queuedUnits,resourceGainTimer); } std::erase_if(units,[&](std::shared_ptru){ @@ -700,8 +701,8 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ unitCreationList.DrawDecal(this); platformCreationList.DrawDecal(this); - DrawResourceBar(); - + 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(); unitCreationBox.UpdateAndDraw(GetMousePos()+vi2d{8,-28},this,player_resources,IMAGES); @@ -733,12 +734,15 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ return true; } -void VirusAttack::DrawResourceBar(){ +void VirusAttack::DrawResourceBar(float fElapsedTime){ + for(int i=0;iDecal(),{1,1},col); - DrawShadowStringDecal({6.f+index*42+20,2.f},std::to_string(resourceValue),col,BLACK); + DrawShadowStringDecal({6.f+index*42+20,2.f},std::to_string(resourceValue),col,PixelLerp(BLACK,{7, 223, 247},resourceGainTimer[index]/2.0f)); }; DrawResourceDisplay(0,player_resources.health,CONSTANT::HEALTH_COLOR); DrawResourceDisplay(1,player_resources.atkSpd,CONSTANT::ATKSPD_COLOR); diff --git a/olcCodeJam2023Entry/VirusAttack.h b/olcCodeJam2023Entry/VirusAttack.h index df3ac67..22927a9 100644 --- a/olcCodeJam2023Entry/VirusAttack.h +++ b/olcCodeJam2023Entry/VirusAttack.h @@ -67,6 +67,7 @@ private: float updatePixelsTimer=0; const std::arraymatrixLetters={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',}; std::vectoractiveLetters; + std::arrayresourceGainTimer={0}; vf2d startingDragPos=CONSTANT::UNSELECTED; void HandleDraggingSelection(); @@ -83,7 +84,7 @@ private: void RenderCollectionPoints(CollectionPoint*cp); void RenderFogOfWar(); void InitializeSounds(); - void DrawResourceBar(); + void DrawResourceBar(float fElapsedTime); bool UnitCreationClickHandled(); void InitializeGUIs(); bool CanAfford(Resources&resources,std::vector&unitCosts); diff --git a/olcCodeJam2023Entry/assets/guide.png b/olcCodeJam2023Entry/assets/guide.png new file mode 100644 index 0000000000000000000000000000000000000000..db8d3b50dc1e4bb89fe8166a6da2c2a69cf32527 GIT binary patch literal 1267 zcmVEX>4Tx04R}tkv&MmP!xqvQ>7{u2djuUWT;MdQBlWI#UfZJZG~1HOkVmUG-*gu zTpR`0f`dPcRR)mS9HUN0nA`fVy2!*FJ$0ZU-#5Ybr<1T-hF>ouaY+z;1h|XOgAjzb>itw zOXs{#9AYI&AwDM_H|T=Ik6f2se&bwpSm2olA>>?i59 zmKHt&`nG|K>y{?(0hc?#(3371k|X(P355dien#Jv1Nv`)o>g~l&2yYS02!Lq(hYEM z2#gged(GqBUF~!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