X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGamePhysics.java;h=07587e688129906f76e67401b01f8afd15b01778;hb=e0aa1520178df544807f3e803b4b6169346b07fb;hp=2fdc29bca17b88dd066b8ef1ebd8840fc0cab6cb;hpb=524d5abc0b76b25a4cf2b31e6ba4f41a107a5ab6;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java index 2fdc29b..07587e6 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java @@ -94,6 +94,8 @@ public class GamePhysics { while (checkColl(pl.getRect())) pl.position.x += d; } } + if (pl.position.x+pl.texWidth/2<0) pl.position.x+=gameProc.world.getWidth()*16; + if (pl.position.x+pl.texWidth/2>gameProc.world.getWidth()*16) pl.position.x-=gameProc.world.getWidth()*16; if (pl.position.y > gameProc.world.getHeight()*16) { pl.position = gameProc.world.getSpawnPoint().cpy(); } @@ -117,6 +119,8 @@ public class GamePhysics { } mob.moveY.add(gravity); mob.position.add(mob.moveX); + if (mob.position.x+mob.width/2<0) mob.position.x+=gameProc.world.getWidth()*16; + if (mob.position.x+mob.width/2>gameProc.world.getWidth()*16) mob.position.x-=gameProc.world.getWidth()*16; if (checkColl(mob.getRect())) { int d = 0; if (mob.moveX.x<0) d=1; else if (mob.moveX.x>0) d=-1;