Added guide plus resource indicator increase highlighting.

CorrectiveAction
sigonasr2 1 year ago
parent 76620a720d
commit 223e26afe5
  1. 1
      olcCodeJam2023Entry/Image.h
  2. 69
      olcCodeJam2023Entry/Info.txt
  3. 19
      olcCodeJam2023Entry/Unit.cpp
  4. 2
      olcCodeJam2023Entry/Unit.h
  5. 14
      olcCodeJam2023Entry/VirusAttack.cpp
  6. 3
      olcCodeJam2023Entry/VirusAttack.h
  7. BIN
      olcCodeJam2023Entry/assets/guide.png

@ -37,5 +37,6 @@ enum Image{
TURRET,
PLATFORM,
GUARD_ICON,
GUIDE,
};

@ -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)

@ -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<Memory> LeftShifter::resourceCost={{RANGE,2},{ATKSPD,2},{MOVESPD,3},{PROCEDURE,1},{HEALTH,4}};
LeftShifter::LeftShifter(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<std::shared_ptr<Unit>>&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<Memory> RightShifter::resourceCost={{HEALTH,4},{RANGE,2},{ATKSPD,2},{MOVESPD,3},{PROCEDURE,1}};
RightShifter::RightShifter(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<std::shared_ptr<Unit>>&otherUnits
int attempts=0;
while(attempts<maxAttempts){
int randomBit=rand()%u->GetMemorySize();
if(u->memory[randomBit]){
if(!u->memory[randomBit]){
u->memory[randomBit]=true;
return;
}
@ -400,7 +400,7 @@ void MemoryGuard::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUni
}
Unit::Unit(PixelGameEngine*pge,std::vector<Memory>memory,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<mem.size;i++){
@ -637,7 +637,7 @@ void Unit::_RunAI(PixelGameEngine*pge){
RunAI(pge);
}
void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector<std::unique_ptr<Unit>>&queuedUnits){
void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector<std::unique_ptr<Unit>>&queuedUnits,std::array<float,5>&resourceGainTimer){
if(!target.expired()){
auto ptrTarget=target.lock();
if(!InRange(ptrTarget)&&CanMove()){
@ -668,18 +668,23 @@ void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&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<Sound,std::unique_ptr<Audio>>&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_ptr<Unit>attacker,std::weak_ptr<Unit>unit,std::vector<std::shared_ptr<Unit>>&otherUnits,std::vector<DebuffIcon>&debuffIcons,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){

@ -71,7 +71,7 @@ public:
bool GhostInFogOfWar();
void HideGhost();
vf2d GetGhostPos();
void _Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector<std::unique_ptr<Unit>>&queuedUnits);
void _Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SOUNDS,Resources&player_resources,Resources&enemy_resources,std::vector<std::unique_ptr<Unit>>&queuedUnits,std::array<float,5>&resourceGainTimer);
bool IsMoveable();
void DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std::map<Image,std::unique_ptr<Renderable>>&IMAGES);
bool CanInteractWithEnemies();

@ -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_ptr<Unit>u){
@ -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;i<resourceGainTimer.size();i++){
resourceGainTimer[i]=std::max(0.f,resourceGainTimer[i]-fElapsedTime);
}
GradientFillRectDecal({0,0},{float(ScreenWidth()),12.f},BLACK,{VERY_DARK_BLUE.r,VERY_DARK_BLUE.g,VERY_DARK_BLUE.b,128},{VERY_DARK_BLUE.r,VERY_DARK_BLUE.g,VERY_DARK_BLUE.b,128},BLACK);
DrawRectDecal({0,0},{float(ScreenWidth()),12.f},{3, 194, 252});
auto DrawResourceDisplay=[&](int index,int resourceValue,Pixel col){
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,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);

@ -67,6 +67,7 @@ private:
float updatePixelsTimer=0;
const std::array<char,16>matrixLetters={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',};
std::vector<Letter>activeLetters;
std::array<float,5>resourceGainTimer={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<Memory>&unitCosts);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Loading…
Cancel
Save