diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
index f49eb178b9f9501ebfb783cc0382debde6ac190e..f8843f2c6851ba086a4c3a8e3fbb6aeccb61e529 100644 (file)
private boolean checkColl(Rectangle rect) {
int[] bl = new int [6];
- bl[0] = gameProc.world.getForeMap(((int)(rect.x+2)/16), ((int)rect.y/16));
- bl[1] = gameProc.world.getForeMap(((int)(rect.x+rect.width-2)/16), ((int)rect.y/16));
- bl[2] = gameProc.world.getForeMap(((int)(rect.x+2)/16), ((int)(rect.y+rect.height/2)/16));
- bl[3] = gameProc.world.getForeMap(((int)(rect.x+rect.width-2)/16), ((int)(rect.y+rect.height/2)/16));
- bl[4] = gameProc.world.getForeMap(((int)(rect.x+2)/16), ((int)(rect.y+rect.height-1)/16));
- bl[5] = gameProc.world.getForeMap(((int)(rect.x+rect.width-2)/16), ((int)(rect.y+(rect.height-1))/16));
+ bl[0] = gameProc.world.getForeMap(((int)(rect.x)/16), ((int)rect.y/16));
+ bl[1] = gameProc.world.getForeMap(((int)(rect.x+rect.width-1)/16), ((int)rect.y/16));
+ bl[2] = gameProc.world.getForeMap(((int)(rect.x)/16), ((int)(rect.y+rect.height/2)/16));
+ bl[3] = gameProc.world.getForeMap(((int)(rect.x+rect.width-1)/16), ((int)(rect.y+rect.height/2)/16));
+ bl[4] = gameProc.world.getForeMap(((int)(rect.x)/16), ((int)(rect.y+rect.height-1)/16));
+ bl[5] = gameProc.world.getForeMap(((int)(rect.x+rect.width-1)/16), ((int)(rect.y+(rect.height-1))/16));
for (int b: bl) if (b>0) {
return true;
}
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;
} else {
pl.canJump = false;
}
- pl.moveY.add(gravity);
+ if (!pl.flyMode) pl.moveY.add(gravity);
pl.position.add(pl.moveX);
if (pl.position.x<0 ||
pl.position.x+pl.width>gameProc.world.getWidth()*16)