Increment/Decrement lerp indicators. Added memory usage bar.

CorrectiveAction
sigonasr2 1 year ago
parent 4b1cc3043a
commit 86121c9da8
  1. 5
      olcCodeJam2023Entry/Constant.cpp
  2. 3
      olcCodeJam2023Entry/Constant.h
  3. 2
      olcCodeJam2023Entry/Image.h
  4. 9
      olcCodeJam2023Entry/Info.txt
  5. 5
      olcCodeJam2023Entry/Level.h
  6. 23
      olcCodeJam2023Entry/Unit.cpp
  7. 179
      olcCodeJam2023Entry/VirusAttack.cpp
  8. 16
      olcCodeJam2023Entry/VirusAttack.h
  9. BIN
      olcCodeJam2023Entry/assets/round_bar.png
  10. BIN
      olcCodeJam2023Entry/assets/round_bar_left.png
  11. BIN
      olcCodeJam2023Entry/assets/segmentBar.png

@ -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";
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};

@ -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;
};

@ -38,5 +38,7 @@ enum Image{
PLATFORM,
GUARD_ICON,
GUIDE,
ROUND_BAR,
SEGMENT_BAR,
};

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

@ -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;
};

@ -8,7 +8,7 @@
std::string LeftShifter::unitName="Left Shifter";
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}};
std::vector<Memory> LeftShifter::resourceCost={{RANGE,2},{ATKSPD,2},{MOVESPD,6},{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){}
@ -18,7 +18,7 @@ void LeftShifter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUni
std::string RightShifter::unitName="Right Shifter";
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}};
std::vector<Memory> RightShifter::resourceCost={{HEALTH,4},{RANGE,2},{ATKSPD,2},{MOVESPD,6},{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){}
@ -28,7 +28,7 @@ void RightShifter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUn
std::string BitRestorer::unitName="Bit Restorer";
std::string BitRestorer::unitDescription="Randomly restores 1 missing bit to a target.";
std::vector<Memory> BitRestorer::resourceCost={{PROCEDURE,6},{RANGE,1},{ATKSPD,1},{MOVESPD,1},{HEALTH,2}};
std::vector<Memory> BitRestorer::resourceCost={{PROCEDURE,6},{RANGE,1},{ATKSPD,1},{MOVESPD,2},{HEALTH,2}};
BitRestorer::BitRestorer(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<std::shared_ptr<Unit>>&ot
std::string MemorySwapper::unitName="Memory Swapper";
std::string MemorySwapper::unitDescription="Flips the orientation of all bits of a target around.";
std::vector<Memory> MemorySwapper::resourceCost={{RANGE,3},{ATKSPD,1},{HEALTH,3},{PROCEDURE,3},{MOVESPD,2}};
std::vector<Memory> MemorySwapper::resourceCost={{RANGE,3},{ATKSPD,1},{HEALTH,3},{PROCEDURE,3},{MOVESPD,4}};
MemorySwapper::MemorySwapper(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<std::shared_ptr<Unit>>&otherU
std::string Corrupter::unitName="Corrupter";
std::string Corrupter::unitDescription="Chooses a random bit and negates it on a target.";
std::vector<Memory> Corrupter::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,4},{HEALTH,4}};
std::vector<Memory> Corrupter::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,8},{HEALTH,4}};
Corrupter::Corrupter(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<std::shared_ptr<Unit>>&otherUnits
std::string MemoryAllocator::unitName="Memory Allocator";
std::string MemoryAllocator::unitDescription="A unit that builds other units.";
std::vector<Memory> MemoryAllocator::resourceCost={{RANGE,1},{ATKSPD,1},{MOVESPD,1},{PROCEDURE,1},{HEALTH,1}};
std::vector<Memory> MemoryAllocator::resourceCost={{RANGE,1},{ATKSPD,1},{MOVESPD,2},{PROCEDURE,1},{HEALTH,1}};
MemoryAllocator::MemoryAllocator(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<Image,std::unique_ptr<Ren
std::string Refresher::unitName="Refresher";
std::string Refresher::unitDescription="Repairs missing bits to surrounding units.";
std::vector<Memory> Refresher::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{MOVESPD,4},{HEALTH,4}};
std::vector<Memory> Refresher::resourceCost={{ATKSPD,3},{RANGE,1},{PROCEDURE,8},{HEALTH,4}};
Refresher::Refresher(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&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<Sound,std::unique_ptr<Audio>>&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<float>(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<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;
}
resourceGainIcons.push_back({IMAGES[RESOURCE].get(),attachedPoint.lock()->type,GetPos()});

@ -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<UnitData>&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<vf2d,float> key){return key.second<=0;});
playerUsedMemory=enemyUsedMemory={0};
for(auto&u:units){
u->SaveMemory();
std::weak_ptr<Unit>closestUnit;
@ -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_ptr<Unit>u){
@ -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(memoryDisplayAmt<lastTotalMemory){
memoryDisplayAmt+=1;
}
memoryDisplayDelay=0.01;
}
lastDisplayMemoryUpdateTimer-=fElapsedTime;
if(lastDisplayMemoryUpdateTimer<=0){
for(int i=0;i<playerUsedMemory.size();i++){
if(playerUsedMemory[i]<playerUsedDisplayMemory[i]){
playerUsedDisplayMemory[i]--;
} else
if(playerUsedMemory[i]>playerUsedDisplayMemory[i]){
playerUsedDisplayMemory[i]++;
}
}
for(int i=0;i<enemyUsedMemory.size();i++){
if(enemyUsedMemory[i]<enemyUsedDisplayMemory[i]){
enemyUsedDisplayMemory[i]--;
} else
if(enemyUsedMemory[i]>enemyUsedDisplayMemory[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;i<playerUsedDisplayMemory.size();i++){
float barSegmentWidth=(float(playerUsedDisplayMemory[i])/currentLevel->availableMemory)*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;i<enemyUsedDisplayMemory.size();i++){
float barSegmentWidth=(float(enemyUsedDisplayMemory[i])/currentLevel->availableMemory)*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;i<barWidth;i++){
DrawPartialDecal(barPos+vf2d{3,0},{barWidth,5},IMAGES[ROUND_BAR]->Decal(),{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()<lastTotalMemory){
memoryIncreased=false;
memoryChangeTimer=2;
}
lastTotalMemory=GetTotalUsedMemory();
DrawShadowStringPropDecal(textPos,std::to_string(memoryDisplayAmt)+"/"+std::to_string(currentLevel->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;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){
auto DrawResourceDisplay=[&](int index,int resourceValue,int&previousResourceValue,int&displayResourceValue,Pixel col){
resourceDisplayValueUpdateTimer[index]-=fElapsedTime;
if(previousResourceValue<resourceValue){
resourceIncreased[index]=true;
resourceGainTimer[index]=2;
previousResourceValue=resourceValue;
} else
if(previousResourceValue>resourceValue){
resourceIncreased[index]=false;
resourceGainTimer[index]=2;
previousResourceValue=resourceValue;
}
if(resourceDisplayValueUpdateTimer[index]<=0){
if(displayResourceValue<resourceValue){
displayResourceValue++;
} else
if(displayResourceValue>resourceValue){
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<Memory>&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;

@ -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::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};
std::array<float,5>resourceDisplayValueUpdateTimer={0};
std::array<bool,5>resourceIncreased={false};
std::array<int,5>playerUsedMemory={0},enemyUsedMemory={0};
std::array<int,5>playerUsedDisplayMemory={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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Loading…
Cancel
Save