|
|
@ -34,6 +34,12 @@ void VirusAttack::InitializeImages(){ |
|
|
|
LoadImage(UNIT_ALLOCATOR,"assets/shell.png"); |
|
|
|
LoadImage(UNIT_ALLOCATOR,"assets/shell.png"); |
|
|
|
LoadImage(RAM_BANK,"assets/ram_bank.png"); |
|
|
|
LoadImage(RAM_BANK,"assets/ram_bank.png"); |
|
|
|
LoadImage(RANGE_INDICATOR,"assets/range_indicator.png"); |
|
|
|
LoadImage(RANGE_INDICATOR,"assets/range_indicator.png"); |
|
|
|
|
|
|
|
LoadImage(DOWN_ARROW,"assets/down_arrow.png"); |
|
|
|
|
|
|
|
LoadImage(RED_X,"assets/red_x.png"); |
|
|
|
|
|
|
|
LoadImage(RLD,"assets/rld.png"); |
|
|
|
|
|
|
|
LoadImage(PRC,"assets/prc.png"); |
|
|
|
|
|
|
|
LoadImage(RNG,"assets/rng.png"); |
|
|
|
|
|
|
|
LoadImage(SPD,"assets/spd.png"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool VirusAttack::OnUserCreate(){ |
|
|
|
bool VirusAttack::OnUserCreate(){ |
|
|
@ -107,9 +113,17 @@ void VirusAttack::HandleDraggingSelection(){ |
|
|
|
if(endDragPos.x<startingDragPos.x){std::swap(startingDragPos.x,endDragPos.x);} |
|
|
|
if(endDragPos.x<startingDragPos.x){std::swap(startingDragPos.x,endDragPos.x);} |
|
|
|
if(endDragPos.y<startingDragPos.y){std::swap(startingDragPos.y,endDragPos.y);} |
|
|
|
if(endDragPos.y<startingDragPos.y){std::swap(startingDragPos.y,endDragPos.y);} |
|
|
|
geom2d::rect<float> selectionRegion(startingDragPos,endDragPos-startingDragPos); |
|
|
|
geom2d::rect<float> 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){ |
|
|
|
for(auto&u:units){ |
|
|
|
if(u->IsFriendly()){ |
|
|
|
if(u->IsFriendly()){ |
|
|
|
if(geom2d::overlaps(selectionRegion,u->GetPos())){ |
|
|
|
if(geom2d::overlaps(selectionRegion,geom2d::circle<float>(u->GetPos(),u->GetUnitSize().x/2))){ |
|
|
|
u->Select(); |
|
|
|
u->Select(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -328,9 +342,6 @@ bool VirusAttack::OnUserUpdate(float fElapsedTime){ |
|
|
|
HandleMinimapClick(); |
|
|
|
HandleMinimapClick(); |
|
|
|
AL.vecPos=game.GetWorldOffset()+GetScreenSize()/2; |
|
|
|
AL.vecPos=game.GetWorldOffset()+GetScreenSize()/2; |
|
|
|
AL.OnUserUpdate(fElapsedTime); |
|
|
|
AL.OnUserUpdate(fElapsedTime); |
|
|
|
if (GetKey(olc::Key::P).bPressed){ |
|
|
|
|
|
|
|
AS_Test.Play({0,0},1,1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(auto&tile:TileManager::visibleTiles){ |
|
|
|
for(auto&tile:TileManager::visibleTiles){ |
|
|
|
tile.second-=fElapsedTime; |
|
|
|
tile.second-=fElapsedTime; |
|
|
|