Collision boundary teleport fix.

This commit is contained in:
sigonasr2 2023-09-04 04:10:00 -05:00
parent 8b17d9bcbd
commit 020c15bcc3
3 changed files with 2 additions and 2 deletions

View File

@ -170,7 +170,7 @@ void MemoryAllocator::Update(PixelGameEngine*pge,std::vector<std::unique_ptr<Aud
} }
void MemoryAllocator::Draw(TileTransformedView&game,std::vector<std::unique_ptr<Renderable>>&IMAGES){ void MemoryAllocator::Draw(TileTransformedView&game,std::vector<std::unique_ptr<Renderable>>&IMAGES){
if(IsBuilding()){ if(IsBuilding()&&!InFogOfWar()){
game.GetPGE()->SetDrawTarget(img.Sprite()); game.GetPGE()->SetDrawTarget(img.Sprite());
game.GetPGE()->Clear(BLANK); game.GetPGE()->Clear(BLANK);
Renderable&targetImg=buildTransformUnit->GetImage(); Renderable&targetImg=buildTransformUnit->GetImage();

View File

@ -885,7 +885,7 @@ void VirusAttack::CollisionChecking(std::shared_ptr<Unit>u,std::shared_ptr<Unit>
u->SetPos({float(WORLD_SIZE.x*CONSTANT::TILE_SIZE.x),u->GetPos().y}); u->SetPos({float(WORLD_SIZE.x*CONSTANT::TILE_SIZE.x),u->GetPos().y});
} }
if(u->GetPos().y<0){ if(u->GetPos().y<0){
u->SetPos({u->GetPos().y,0}); u->SetPos({u->GetPos().x,0});
} }
if(u->GetPos().y>WORLD_SIZE.y*CONSTANT::TILE_SIZE.y){ if(u->GetPos().y>WORLD_SIZE.y*CONSTANT::TILE_SIZE.y){
u->SetPos({u->GetPos().x,float(WORLD_SIZE.y*CONSTANT::TILE_SIZE.y)}); u->SetPos({u->GetPos().x,float(WORLD_SIZE.y*CONSTANT::TILE_SIZE.y)});

Binary file not shown.