diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 46032c0..b139410 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index 5ba8a49..8bf33d2 100644 --- a/main.cpp +++ b/main.cpp @@ -70,12 +70,12 @@ void Meteos::updateGame(float fElapsedTime){ if (c2.getBlockPosition(b2).x==c.getBlockPosition(b3).x&& c2.getBlockPosition(b2).y+12>=c.getBlockPosition(b3).y&& c2.getBlockPosition(b2).y<=c.getBlockPosition(b3).y+12) { - float yDiff=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? - c2.getBlockPosition(b2).y-c.getBlockPosition(b3).y: - c.getBlockPosition(b3).y-c2.getBlockPosition(b2).y; - c2.y+=(c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y)? - - yDiff:-yDiff; + + if (c2.getBlockPosition(b2).y>c.getBlockPosition(b3).y) { + c.y-=12-(c2.getBlockPosition(b2).y-c.getBlockPosition(b3).y); + } else { + c2.y-=12-(c.getBlockPosition(b3).y-c2.getBlockPosition(b2).y); + } float influence=(float)c.getBlocks().size()/(c.getBlocks().size()+c2.getBlocks().size()); int blockCount=c.getBlocks().size(); //Copy every block from one clump to the other