diff --git a/olcCodeJam2023Entry/Unit.cpp b/olcCodeJam2023Entry/Unit.cpp index 656fc7b..80ec999 100644 --- a/olcCodeJam2023Entry/Unit.cpp +++ b/olcCodeJam2023Entry/Unit.cpp @@ -223,6 +223,7 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std:: float dist=geom2d::line(game.ScreenToWorld(pge->GetMousePos()),GetGhostPos()).length(); float range=12*(GetRange()+1); float totalRange=GetUnitSize().x/2+range; + if(IsSelected()){ Pixel col; if(CanInteractWithAllies()&&!CanInteractWithEnemies()){ @@ -231,6 +232,7 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std:: col={0,196,0}; } game.DrawRotatedDecal(GetGhostPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},col); + }else if(distDecal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},{col.r,col.g,col.b,uint8_t((1.f-(dist/(range*2)))*255)}); + uint8_t transparency=uint8_t((1.f-(dist/(range*2)))*255); + game.DrawRotatedDecal(GetGhostPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},{col.r,col.g,col.b,transparency}); } } @@ -310,6 +313,40 @@ void Unit::DrawHud(TileTransformedView&game,std::map>&IMAGES){ + float dist=geom2d::line(game.ScreenToWorld(pge->GetMousePos()),GetGhostPos()).length(); + float range=12*(GetRange()+1); + + + + auto DrawStatDown=[&](Marker&maxStat,int currentStat,vf2d pos,vf2d downDisplayPos,Image img,uint8_t transparency=255){ + if(maxStat.size>0){ + if(currentStat!=maxStat.size){ + game.DrawDecal(this->pos+pos,IMAGES[img]->Decal(),{1,1},{255,255,255,transparency}); + if(currentStat>0){ + game.DrawDecal(this->pos+downDisplayPos,IMAGES[DOWN_ARROW]->Decal(),{1,1},{255,255,255,transparency}); + } else { + game.DrawDecal(this->pos+downDisplayPos,IMAGES[RED_X]->Decal(),{1,1},{255,255,255,transparency}); + } + } + } + }; + + if(IsSelected()){ + DrawStatDown(atkSpd,GetAtkSpd(),{-48-8,-24},{-48+8,-18},RLD); + DrawStatDown(moveSpd,GetMoveSpd(),{-48-8,8},{-48+8,2},SPD); + DrawStatDown(this->range,GetRange(),{8,-24},{36,-18},RNG); + DrawStatDown(procedure,GetProcedure(),{8,8},{36,2},PRC); + }else + if(distrange,GetRange(),{8,-24},{26,-18},RNG,transparency); + DrawStatDown(procedure,GetProcedure(),{8,8},{26,2},PRC,transparency); } } diff --git a/olcCodeJam2023Entry/Unit.h b/olcCodeJam2023Entry/Unit.h index 00dbbbb..f8a6473 100644 --- a/olcCodeJam2023Entry/Unit.h +++ b/olcCodeJam2023Entry/Unit.h @@ -64,6 +64,7 @@ public: virtual void Attacked(std::weak_ptrattacker); void _Attacked(std::weak_ptrattacker); std::weak_ptrGetCurrentTarget(); + void DrawUnitDamageStats(PixelGameEngine*pge,TileTransformedView&game,std::map>&IMAGES); std::vector& operator <<=(const int n){ for(int i=0;i(vf2d{360,300},IMAGES,false)); + for(int i=0;iGetMemorySize();i++){ + units[0]->memory[i]=units[0]->ghostMemory[i]=i%2==0; + } + return true; } @@ -399,6 +403,7 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ } for(auto&u:units){ + u->DrawUnitDamageStats(this,game,IMAGES); u->DrawHud(game,IMAGES); } diff --git a/olcCodeJam2023Entry/assets/prc.png b/olcCodeJam2023Entry/assets/prc.png index db07925..96f2f11 100644 Binary files a/olcCodeJam2023Entry/assets/prc.png and b/olcCodeJam2023Entry/assets/prc.png differ diff --git a/olcCodeJam2023Entry/assets/rld.png b/olcCodeJam2023Entry/assets/rld.png index c4eb29b..3845738 100644 Binary files a/olcCodeJam2023Entry/assets/rld.png and b/olcCodeJam2023Entry/assets/rld.png differ diff --git a/olcCodeJam2023Entry/assets/rng.png b/olcCodeJam2023Entry/assets/rng.png index 104e48b..99887bd 100644 Binary files a/olcCodeJam2023Entry/assets/rng.png and b/olcCodeJam2023Entry/assets/rng.png differ diff --git a/olcCodeJam2023Entry/assets/spd.png b/olcCodeJam2023Entry/assets/spd.png index 251634a..b2f6e3d 100644 Binary files a/olcCodeJam2023Entry/assets/spd.png and b/olcCodeJam2023Entry/assets/spd.png differ