diff --git a/olcCodeJam2023Entry/Constant.cpp b/olcCodeJam2023Entry/Constant.cpp index 32dbbc5..a2d578f 100644 --- a/olcCodeJam2023Entry/Constant.cpp +++ b/olcCodeJam2023Entry/Constant.cpp @@ -1,6 +1,6 @@ #include "Constant.h" -vf2d CONSTANT::BAR_SQUARE_SIZE={4,4}; +vf2d CONSTANT::BAR_SQUARE_SIZE={1,4}; Pixel CONSTANT::HEALTH_COLOR={235, 210, 52}; Pixel CONSTANT::RANGE_COLOR={52, 235, 89}; Pixel CONSTANT::ATKSPD_COLOR={140, 21, 13}; diff --git a/olcCodeJam2023Entry/Image.h b/olcCodeJam2023Entry/Image.h index 5fbecc7..0a8a71c 100644 --- a/olcCodeJam2023Entry/Image.h +++ b/olcCodeJam2023Entry/Image.h @@ -17,6 +17,12 @@ enum Image{ CORRUPTER, UNIT_ALLOCATOR, RAM_BANK, - RANGE_INDICATOR + RANGE_INDICATOR, + DOWN_ARROW, + RED_X, + RLD, + PRC, + RNG, + SPD, }; diff --git a/olcCodeJam2023Entry/Unit.cpp b/olcCodeJam2023Entry/Unit.cpp index 9e2a53e..656fc7b 100644 --- a/olcCodeJam2023Entry/Unit.cpp +++ b/olcCodeJam2023Entry/Unit.cpp @@ -135,7 +135,7 @@ MemoryAllocator::MemoryAllocator(vf2d pos,std::map>&otherUnits){ @@ -282,6 +282,27 @@ void Unit::DrawHud(TileTransformedView&game,std::map0){ + game.FillRectDecal(vf2d{float(initialBarX)+health.index*CONSTANT::BAR_SQUARE_SIZE.x, + float(initialBarY)}-vf2d{0,1},CONSTANT::BAR_SQUARE_SIZE+vf2d{CONSTANT::BAR_SQUARE_SIZE.x*health.size-1,2},CONSTANT::HEALTH_COLOR); + } + if(GetAtkSpd()>0){ + game.FillRectDecal(vf2d{float(initialBarX)+atkSpd.index*CONSTANT::BAR_SQUARE_SIZE.x, + float(initialBarY)}-vf2d{0,1},CONSTANT::BAR_SQUARE_SIZE+vf2d{CONSTANT::BAR_SQUARE_SIZE.x*atkSpd.size-1,2},CONSTANT::ATKSPD_COLOR); + } + if(GetMoveSpd()>0){ + game.FillRectDecal(vf2d{float(initialBarX)+moveSpd.index*CONSTANT::BAR_SQUARE_SIZE.x, + float(initialBarY)}-vf2d{0,1},CONSTANT::BAR_SQUARE_SIZE+vf2d{CONSTANT::BAR_SQUARE_SIZE.x*moveSpd.size-1,2},CONSTANT::MOVESPD_COLOR); + } + if(GetProcedure()>0){ + game.FillRectDecal(vf2d{float(initialBarX)+procedure.index*CONSTANT::BAR_SQUARE_SIZE.x, + float(initialBarY)}-vf2d{0,1},CONSTANT::BAR_SQUARE_SIZE+vf2d{CONSTANT::BAR_SQUARE_SIZE.x*procedure.size-1,2},CONSTANT::PROCEDURE_COLOR); + } + if(GetRange()>0){ + game.FillRectDecal(vf2d{float(initialBarX)+range.index*CONSTANT::BAR_SQUARE_SIZE.x, + float(initialBarY)}-vf2d{0,1},CONSTANT::BAR_SQUARE_SIZE+vf2d{CONSTANT::BAR_SQUARE_SIZE.x*range.size-1,2},CONSTANT::RANGE_COLOR); + } + for(int i=0;i selectionRegion(startingDragPos,endDragPos-startingDragPos); + if(selectionRegion.size.x<12){ + selectionRegion.pos.x-=12-selectionRegion.size.x/2; + selectionRegion.size.x+=12-selectionRegion.size.x/2; + } + if(selectionRegion.size.y<12){ + selectionRegion.pos.y-=12-selectionRegion.size.y/2; + selectionRegion.size.y+=12-selectionRegion.size.y/2; + } for(auto&u:units){ if(u->IsFriendly()){ - if(geom2d::overlaps(selectionRegion,u->GetPos())){ + if(geom2d::overlaps(selectionRegion,geom2d::circle(u->GetPos(),u->GetUnitSize().x/2))){ u->Select(); } } @@ -328,9 +342,6 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ HandleMinimapClick(); AL.vecPos=game.GetWorldOffset()+GetScreenSize()/2; AL.OnUserUpdate(fElapsedTime); - if (GetKey(olc::Key::P).bPressed){ - AS_Test.Play({0,0},1,1); - } for(auto&tile:TileManager::visibleTiles){ tile.second-=fElapsedTime; diff --git a/olcCodeJam2023Entry/assets/atk.png b/olcCodeJam2023Entry/assets/atk.png new file mode 100644 index 0000000..e3c294f Binary files /dev/null and b/olcCodeJam2023Entry/assets/atk.png differ diff --git a/olcCodeJam2023Entry/assets/down_arrow.png b/olcCodeJam2023Entry/assets/down_arrow.png new file mode 100644 index 0000000..7088510 Binary files /dev/null and b/olcCodeJam2023Entry/assets/down_arrow.png differ diff --git a/olcCodeJam2023Entry/assets/prc.png b/olcCodeJam2023Entry/assets/prc.png new file mode 100644 index 0000000..db07925 Binary files /dev/null and b/olcCodeJam2023Entry/assets/prc.png differ diff --git a/olcCodeJam2023Entry/assets/red_x.png b/olcCodeJam2023Entry/assets/red_x.png new file mode 100644 index 0000000..3b76030 Binary files /dev/null and b/olcCodeJam2023Entry/assets/red_x.png differ diff --git a/olcCodeJam2023Entry/assets/rld.png b/olcCodeJam2023Entry/assets/rld.png new file mode 100644 index 0000000..c4eb29b Binary files /dev/null and b/olcCodeJam2023Entry/assets/rld.png differ diff --git a/olcCodeJam2023Entry/assets/rng.png b/olcCodeJam2023Entry/assets/rng.png new file mode 100644 index 0000000..104e48b Binary files /dev/null and b/olcCodeJam2023Entry/assets/rng.png differ diff --git a/olcCodeJam2023Entry/assets/spd.png b/olcCodeJam2023Entry/assets/spd.png new file mode 100644 index 0000000..251634a Binary files /dev/null and b/olcCodeJam2023Entry/assets/spd.png differ