X-Git-Url: http://deadsoftware.ru/gitweb?p=cavedroid.git;a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FGamePhysics.java;h=c335908a26b41ce274c4e72ec58f80e01f553a19;hp=34c4df111304a96557ee12ec0f767b3e8bfef40f;hb=d5e611f9fb8deb93a9403b41f17dc000b9fa63ce;hpb=8acb72a54d755c4df279244ca986d244e2700a08 diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java index 34c4df1..c335908 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java @@ -26,9 +26,11 @@ public class GamePhysics { switch (dir) { case 0: bl = gameProc.world.getForeMap((int)((rect.x-8)/16),(int)((rect.y+rect.height-8)/16)); + if (checkColl(new Rectangle(rect.x-16, rect.y-18, rect.width, rect.height))) bl=0; break; case 1: bl = gameProc.world.getForeMap((int)((rect.x+rect.width+8)/16),(int)((rect.y+rect.height-8)/16)); + if (checkColl(new Rectangle(rect.x+16, rect.y-18, rect.width, rect.height))) bl=0; break; default: bl=0; @@ -121,6 +123,7 @@ public class GamePhysics { else if (mob.moveX.x > 0) d = -1; mob.position.x = MathUtils.round(mob.position.x); while (checkColl(mob.getRect())) mob.position.x += d; + if (mob.canJump) mob.changeDir(); } } if (mob.position.x+mob.width/2<0) mob.position.x+=gameProc.world.getWidth()*16;