diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
index 1bedc729471a0a022c701bca28c56ebfbb674d04..8e12e7292a3dca7bd37a790a97f27aba9e264576 100644 (file)
public GamePhysics(GameProc gameProc) {
this.gameProc = gameProc;
- gravity = new Vector2(0,1);
+ gravity = new Vector2(0,.9f);
}
private boolean checkJump(Rectangle rect, int dir) {
bl = gameProc.world.getForeMap(
(int)((rect.x+(rect.width/2))/16) - 1,
(int)(rect.y/16)+1);
+ if (gameProc.world.getForeMap((int)((rect.x+(rect.width/2))/16)-1,(int)(rect.y/16))>0) bl=0;
break;
case 1:
if ((int)((rect.x+(rect.width/2))/16) + 1<gameProc.world.getWidth())
bl = gameProc.world.getForeMap(
(int)((rect.x+(rect.width/2))/16) + 1,
(int)(rect.y/16)+1);
+ if (gameProc.world.getForeMap((int)((rect.x+(rect.width/2))/16)+1,(int)(rect.y/16))>0) bl=0;
break;
default:
bl=0;
private void playerPhy(Player pl) {
pl.position.add(pl.moveY);
if (checkColl(pl.getRect())) {
- pl.flyMode = false;
- pl.canJump = true;
int d = -1;
if (pl.moveY.y<0) d=1; else if (pl.moveY.y>0) d=-1;
+ if (d==-1) {
+ pl.flyMode = false;
+ pl.canJump = true;
+ }
pl.position.y = MathUtils.round(pl.position.y);
while (checkColl(pl.getRect())) pl.position.y+=d;
pl.moveY.setZero();
} else {
pl.canJump = false;
}
- if (!pl.flyMode) pl.moveY.add(gravity);
+ if (!pl.flyMode && pl.moveY.y<18) pl.moveY.add(gravity);
pl.position.add(pl.moveX);
if (pl.position.x<0 ||
pl.position.x+pl.texWidth>=gameProc.world.getWidth()*16)