Collision boundary teleport fix.

master
sigonasr2 1 year ago
parent 8b17d9bcbd
commit 020c15bcc3
  1. 2
      olcCodeJam2023Entry/Unit.cpp
  2. 2
      olcCodeJam2023Entry/VirusAttack.cpp
  3. BIN
      olcCodeJam2023Entry/pge.wasm

@ -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();

@ -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.
Loading…
Cancel
Save