summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e90179)
raw | patch | inline | side by side (parent: 7e90179)
author | fred-boy <fred-boy@protonmail.com> | |
Sat, 21 Apr 2018 18:22:03 +0000 (01:22 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Sat, 21 Apr 2018 18:22:03 +0000 (01:22 +0700) |
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java
index b20575a7034b927ee201e3c56bda7d91a449ae77..07587e688129906f76e67401b01f8afd15b01778 100644 (file)
private boolean checkJump(Rectangle rect, int dir) {
int bl = 0;
- if (rect.x<0) rect.x-=16;
switch (dir) {
case 0:
bl = gameProc.world.getForeMap(
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();
}
}
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;
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java
index f3ea4ac131f79be3bfacd01cdac8449f7bfde00c..2cdc302291cac2ec1c3faf961c5a8285cd261b13 100644 (file)
if (player.dir == 0) cursorX++;
else cursorX--;
}
- if (player.position.x<0) cursorX--;
} else if (!CaveGame.TOUCH){
cursorX = (int)(Gdx.input.getX()*
(renderer.camera.viewportWidth/GameScreen.getWidth())+renderer.camera.position.x)/16;
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java
index 944093826043bbd51204107b89fabddd04e193c9..009d9b75765768e7a793daec3228a0230f7a4d09 100644 (file)
}
private void drawMob(Mob mob) {
+ mob.draw(spriteBatch,
+ mob.position.x-camera.position.x-gameProc.world.getWidth()*16, mob.position.y-camera.position.y);
mob.draw(spriteBatch,
mob.position.x-camera.position.x, mob.position.y-camera.position.y);
+ mob.draw(spriteBatch,
+ mob.position.x-camera.position.x+gameProc.world.getWidth()*16, mob.position.y-camera.position.y);
}
private void drawPlayer(Player pl) {
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
index ab89dd78d2b423c022e448145a266bdc0cb256bf..daa00c004af21ce8356aeec57d0f276d18865376 100644 (file)
int map = 0;
try {
if (x<0) {
- x = x % (getWidth()-1)-1;
+ x = x % (getWidth());
x = getWidth()- Math.abs(x);
} else if (x>0) {
- x = x % (getWidth()-1)+1;
+ x = x % (getWidth());
}
map = foreMap[x][y];
} catch (ArrayIndexOutOfBoundsException e) {
public void setForeMap(int x, int y, int value) {
try {
if (x<0) {
- x = x % (getWidth()-1)-1;
+ x = x % (getWidth());
x = getWidth()- Math.abs(x);
} else if (x>0) {
- x = x % (getWidth()-1)+1;
+ x = x % (getWidth());
}
foreMap[x][y] = value;
} catch (ArrayIndexOutOfBoundsException e) {
int map = 0;
try {
if (x<0) {
- x = x % (getWidth()-1)-1;
+ x = x % (getWidth());
x = getWidth()- Math.abs(x);
} else if (x>0) {
- x = x % (getWidth()-1)+1;
+ x = x % (getWidth());
}
map = backMap[x][y];
} catch (ArrayIndexOutOfBoundsException e) {
public void setBackMap(int x, int y, int value) {
try {
if (x<0) {
- x = x % (getWidth()-1)-1;
+ x = x % (getWidth());
x = getWidth()- Math.abs(x);
} else if (x>0) {
- x = x % (getWidth()-1)+1;
+ x = x % (getWidth());
}
backMap[x][y] = value;
} catch (ArrayIndexOutOfBoundsException e) {