From 7f1f702250f9cd05c1d7f5492e09ba16a56270ae Mon Sep 17 00:00:00 2001 From: fred-boy Date: Mon, 10 Sep 2018 23:06:28 +0700 Subject: [PATCH] Minor enhancements --- .../cavecraft/game/GameInput.java | 6 +- .../cavecraft/game/GamePhysics.java | 6 +- .../deadsoftware/cavecraft/game/GameProc.java | 129 +++++++++--------- .../cavecraft/game/GameRenderer.java | 4 +- .../cavecraft/game/GameWorld.java | 31 ++++- .../ru/deadsoftware/cavecraft/game/Items.java | 26 ++-- .../deadsoftware/cavecraft/game/WorldGen.java | 32 ++++- 7 files changed, 152 insertions(+), 82 deletions(-) diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java index c868a8a..7a66d99 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java @@ -18,7 +18,7 @@ public class GameInput { } private boolean checkSwim() { - return (CaveGame.TOUCH && Items.isFluid(gameProc.world.getForeMap((int)(gameProc.player.position.x+gameProc.player.width/2)/16, + return (Items.isFluid(gameProc.world.getForeMap((int)(gameProc.player.position.x+gameProc.player.width/2)/16, (int)(gameProc.player.position.y+gameProc.player.height/4*3)/16))); } @@ -28,10 +28,12 @@ public class GameInput { case Input.Keys.A: gameProc.player.moveX.x = -GamePhysics.PL_SPEED; gameProc.player.dir = 0; + if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true; break; case Input.Keys.D: gameProc.player.moveX.x = GamePhysics.PL_SPEED; gameProc.player.dir = 1; + if (CaveGame.TOUCH && checkSwim()) gameProc.swim = true; break; } } else if (CaveGame.TOUCH){ @@ -106,7 +108,7 @@ public class GameInput { switch (keycode) { case Input.Keys.A: case Input.Keys.D: gameProc.player.moveX.x = 0; - if (gameProc.swim) gameProc.swim = false; + if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false; break; case Input.Keys.SPACE: case Input.Keys.CONTROL_LEFT: diff --git a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java index a3410c2..372bf6e 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GamePhysics.java @@ -86,15 +86,15 @@ public class GamePhysics { if (Items.isFluid(getBlock(pl.getRect()))) { if (CaveGame.TOUCH && pl.moveX.x!=0 && !gameProc.swim && !pl.flyMode) gameProc.swim = true; if (!gameProc.swim) { - if (!pl.flyMode && pl.moveY.y < 9) pl.moveY.add(gravity.x / 2, gravity.y / 2); - if (!pl.flyMode && pl.moveY.y > 9) pl.moveY.add(0, -.9f); + if (!pl.flyMode && pl.moveY.y < 4.5f) pl.moveY.add(gravity.x / 4, gravity.y / 4); + if (!pl.flyMode && pl.moveY.y > 4.5f) pl.moveY.add(0, -1f); } else { pl.moveY.add(0, -.5f); if (pl.moveY.y<-3) pl.moveY.y = -3; } } else { if (!pl.flyMode && pl.moveY.y<18) pl.moveY.add(gravity); - if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false; + //if (CaveGame.TOUCH && gameProc.swim) gameProc.swim = false; } pl.position.add(pl.moveX); diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java index 5d20e62..49fe705 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameProc.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameProc.java @@ -118,140 +118,147 @@ public class GameProc implements Serializable{ private void updateFluids(int x, int y) { if (Items.isWater(world.getForeMap(x, y)) && world.getForeMap(x, y)!=8) { - if ((!Items.isWater(world.getForeMap(x-1,y)) || + if (world.getForeMap(x, y)==60) { + if (!Items.isWater(world.getForeMap(x, y - 1))) + world.setForeMap(x, y, world.getForeMap(x, y) + 1); + } else if ((!Items.isWater(world.getForeMap(x-1,y)) || (Items.isWater(world.getForeMap(x,y)) && world.getForeMap(x-1, y)>=world.getForeMap(x, y))) && (!Items.isWater(world.getForeMap(x+1,y)) || (Items.isWater(world.getForeMap(x,y)) && world.getForeMap(x+1, y)>=world.getForeMap(x, y)))){ world.setForeMap(x, y, world.getForeMap(x, y)+1); - if (world.getForeMap(x, y)>62) world.setForeMap(x, y, 0); } + if (world.getForeMap(x, y)>63) world.setForeMap(x, y, 0); } - if (world.getForeMap(x, y) == 8) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) || + if (world.getForeMap(x, y) == 8 || world.getForeMap(x, y) == 60) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,8); + world.setForeMap(x,y+1,60); updateBlock(x, y+2); } else if (Items.isLava(world.getForeMap(x, y+1))) { if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4); - else world.setForeMap(x, y+1, 66); + else world.setForeMap(x, y+1, 68); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) || - (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>60)) { - world.setForeMap(x+1,y,60); + (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>61)) { + world.setForeMap(x+1,y,61); updateBlock(x+1, y+1); } else if (Items.isLava(world.getForeMap(x+1, y))) { if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4); - else world.setForeMap(x+1, y, 66); - } else if (world.getForeMap(x+1, y)==60 && world.getForeMap(x+2, y)==8) world.setForeMap(x+1, y, 8); + else world.setForeMap(x+1, y, 68); + } else if (world.getForeMap(x+1, y)==61 && (world.getForeMap(x+2, y)==8 || world.getForeMap(x+2, y)==60)) world.setForeMap(x+1, y, 8); if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) || - (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>60)) { - world.setForeMap(x-1,y,60); + (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>61)) { + world.setForeMap(x-1,y,61); updateBlock(x-1, y+1); } else if (Items.isLava(world.getForeMap(x-1, y))) { if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4); - else world.setForeMap(x-1, y, 66); - } else if (world.getForeMap(x-1, y)==60 && world.getForeMap(x-2, y)==8) world.setForeMap(x-1, y, 8); + else world.setForeMap(x-1, y, 68); + } else if (world.getForeMap(x-1, y)==61 && (world.getForeMap(x-2, y)==8 || world.getForeMap(x-2, y)==60)) world.setForeMap(x-1, y, 8); } return; } - if (world.getForeMap(x, y) == 60) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) || + if (world.getForeMap(x, y) == 61) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,8); + world.setForeMap(x,y+1,60); updateBlock(x, y+2); } else if (Items.isLava(world.getForeMap(x, y+1))) { if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4); - else world.setForeMap(x, y+1, 66); + else world.setForeMap(x, y+1, 68); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) || - (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>61)){ - world.setForeMap(x+1,y,61); + (Items.isWater(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>62)){ + world.setForeMap(x+1,y,62); updateBlock(x+1, y+1); } else if (Items.isLava(world.getForeMap(x+1, y))) { if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4); - else world.setForeMap(x+1, y, 66); + else world.setForeMap(x+1, y, 68); } if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) || - (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>61)){ - world.setForeMap(x-1,y,61); + (Items.isWater(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>62)){ + world.setForeMap(x-1,y,62); updateBlock(x-1, y+1); } else if (Items.isLava(world.getForeMap(x-1, y))) { if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4); - else world.setForeMap(x-1, y, 66); + else world.setForeMap(x-1, y, 68); } } return; } - if (world.getForeMap(x, y) == 61) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) || + if (world.getForeMap(x, y) == 62) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,8); + world.setForeMap(x,y+1,60); updateBlock(x, y+2); } else if (Items.isLava(world.getForeMap(x, y+1))) { if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4); - else world.setForeMap(x, y+1, 66); + else world.setForeMap(x, y+1, 68); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ){ - world.setForeMap(x+1,y,62); + world.setForeMap(x+1,y,63); updateBlock(x+1, y+1); } else if (Items.isLava(world.getForeMap(x+1, y))) { if (world.getForeMap(x+1, y)>9) world.setForeMap(x+1, y, 4); - else world.setForeMap(x+1, y, 66); + else world.setForeMap(x+1, y, 68); } if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ){ - world.setForeMap(x-1,y,62); + world.setForeMap(x-1,y,63); updateBlock(x-1, y+1); } else if (Items.isLava(world.getForeMap(x-1, y))) { if (world.getForeMap(x-1, y)>9) world.setForeMap(x-1, y, 4); - else world.setForeMap(x-1, y, 66); + else world.setForeMap(x-1, y, 68); } } return; } - if (world.getForeMap(x, y) == 62) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=60 && world.getForeMap(x, y+1)<=62) || + if (world.getForeMap(x, y) == 63) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=61 && world.getForeMap(x, y+1)<=63) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,8); + world.setForeMap(x,y+1,60); updateBlock(x, y+2); } else if (Items.isLava(world.getForeMap(x, y+1))) { if (world.getForeMap(x, y+1)>9) world.setForeMap(x, y+1, 4); - else world.setForeMap(x, y+1, 66); + else world.setForeMap(x, y+1, 68); } return; } if (Items.isLava(world.getForeMap(x, y)) && world.getForeMap(x, y)!=9) { - if ((!Items.isLava(world.getForeMap(x-1,y)) || + if (world.getForeMap(x, y)==64) { + if (!Items.isLava(world.getForeMap(x, y - 1))) + world.setForeMap(x, y, world.getForeMap(x, y) + 1); + } else if ((!Items.isLava(world.getForeMap(x,y-1))) && + (!Items.isLava(world.getForeMap(x-1,y)) || (Items.isLava(world.getForeMap(x,y)) && world.getForeMap(x-1, y)>=world.getForeMap(x, y))) && (!Items.isLava(world.getForeMap(x+1,y)) || (Items.isLava(world.getForeMap(x,y)) && world.getForeMap(x+1, y)>=world.getForeMap(x, y)))){ world.setForeMap(x, y, world.getForeMap(x, y)+1); - if (world.getForeMap(x, y)>65) world.setForeMap(x, y, 0); } + if (world.getForeMap(x, y)>67) world.setForeMap(x, y, 0); } - if (world.getForeMap(x, y) == 9) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) || + if (world.getForeMap(x, y) == 9 || world.getForeMap(x, y) == 64) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,9); + world.setForeMap(x,y+1,64); updateBlock(x, y+2); } else if (Items.isWater(world.getForeMap(x, y+1))) { world.setForeMap(x, y+1, 1); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) || - (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>63)) { - world.setForeMap(x+1,y,63); + (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>65)) { + world.setForeMap(x+1,y,65); updateBlock(x+1, y+1); } else if (Items.isWater(world.getForeMap(x+1, y))) { world.setForeMap(x+1, y, 1); @@ -259,8 +266,8 @@ public class GameProc implements Serializable{ if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) || - (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>63)) { - world.setForeMap(x-1,y,63); + (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>65)) { + world.setForeMap(x-1,y,65); updateBlock(x-1, y+1); } else if (Items.isWater(world.getForeMap(x-1, y))) { world.setForeMap(x-1, y, 1); @@ -268,18 +275,18 @@ public class GameProc implements Serializable{ } return; } - if (world.getForeMap(x, y) == 63) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) || + if (world.getForeMap(x, y) == 65) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,9); + world.setForeMap(x,y+1,64); updateBlock(x, y+2); } else if (Items.isWater(world.getForeMap(x, y+1))) { world.setForeMap(x, y+1, 1); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) || - (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>64)){ - world.setForeMap(x+1,y,64); + (Items.isLava(world.getForeMap(x+1, y)) && world.getForeMap(x+1, y)>66)){ + world.setForeMap(x+1,y,66); updateBlock(x+1, y+1); } else if (Items.isWater(world.getForeMap(x+1, y))) { world.setForeMap(x+1, y, 1); @@ -287,8 +294,8 @@ public class GameProc implements Serializable{ if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) || - (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>64)){ - world.setForeMap(x-1,y,64); + (Items.isLava(world.getForeMap(x-1, y)) && world.getForeMap(x-1, y)>66)){ + world.setForeMap(x-1,y,66); updateBlock(x-1, y+1); } else if (Items.isWater(world.getForeMap(x-1, y))) { world.setForeMap(x-1, y, 1); @@ -296,17 +303,17 @@ public class GameProc implements Serializable{ } return; } - if (world.getForeMap(x, y) == 64) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) || + if (world.getForeMap(x, y) == 66) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,9); + world.setForeMap(x,y+1,64); updateBlock(x, y+2); } else if (Items.isWater(world.getForeMap(x, y+1))) { world.setForeMap(x, y+1, 1); } else if (Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision) { if (world.getForeMap(x+1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x+1, y)).collision && !Items.isFluid(world.getForeMap(x+1, y))) ){ - world.setForeMap(x+1,y,65); + world.setForeMap(x+1,y,67); updateBlock(x+1, y+1); } else if (Items.isWater(world.getForeMap(x+1, y))) { world.setForeMap(x+1, y, 1); @@ -314,7 +321,7 @@ public class GameProc implements Serializable{ if (world.getForeMap(x-1, y)==0 || (!Items.BLOCKS.getValueAt(world.getForeMap(x-1, y)).collision && !Items.isFluid(world.getForeMap(x-1, y))) ){ - world.setForeMap(x-1,y,65); + world.setForeMap(x-1,y,67); updateBlock(x-1, y+1); } else if (Items.isWater(world.getForeMap(x-1, y))) { world.setForeMap(x-1, y, 1); @@ -322,10 +329,10 @@ public class GameProc implements Serializable{ } return; } - if (world.getForeMap(x, y) == 65) { - if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=63 && world.getForeMap(x, y+1)<=65) || + if (world.getForeMap(x, y) == 67) { + if (world.getForeMap(x, y+1)==0 || (world.getForeMap(x, y+1)>=65 && world.getForeMap(x, y+1)<=67) || (!Items.BLOCKS.getValueAt(world.getForeMap(x, y+1)).collision && !Items.isFluid(world.getForeMap(x, y+1)))) { - world.setForeMap(x,y+1,9); + world.setForeMap(x,y+1,64); updateBlock(x, y+2); } else if (Items.isWater(world.getForeMap(x, y+1))) { world.setForeMap(x, y+1, 1); @@ -377,7 +384,7 @@ public class GameProc implements Serializable{ DO_UPD = false; } - for (int y=(int)renderer.camera.position.y/16-1; y<(int)(renderer.camera.position.y+renderer.camera.viewportHeight)/16+1; y++) { + for (int y=0; y0 || gameProc.world.getBackMap(gameProc.cursorX, gameProc.cursorY)>0 || - gameProc.ctrlMode==1) + gameProc.ctrlMode==1 || + !CaveGame.TOUCH) spriteBatch.draw(Assets.guiCur, gameProc.cursorX*16-camera.position.x, gameProc.cursorY*16-camera.position.y); @@ -202,6 +203,7 @@ public class GameRenderer extends Renderer { drawString("X: "+(int)(gameProc.player.position.x/16),0, 10); drawString("Y: "+(int)(gameProc.player.position.y/16),0, 20); drawString("Mobs: "+gameProc.mobs.size(), 0, 30); + drawString("Block: "+Items.BLOCKS.getKeyAt(gameProc.world.getForeMap(gameProc.cursorX, gameProc.cursorY)), 0, 40); } spriteBatch.end(); diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java index 42050e2..88f435b 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java @@ -71,13 +71,38 @@ public class GameWorld { } } + private void placeSlab(int x, int y, int value) { + switch (value) { + case 51: + setForeMap(x, y, 52); + break; + case 53: + setForeMap(x, y, 21); + break; + case 54: + setForeMap(x, y, 5); + break; + case 55: + setForeMap(x, y, 4); + break; + case 56: + setForeMap(x, y, 28); + break; + case 58: + setForeMap(x, y, 57); + break; + } + } + public void placeToForeground(int x, int y, int value) { if (getForeMap(x,y) == 0 || value == 0 || !Items.BLOCKS.getValueAt(getForeMap(x, y)).collision) { setForeMap(x, y, value); - GameProc.UPD_X = x-8; - GameProc.UPD_Y = y-8; - GameProc.DO_UPD = true; + } else if (Items.isSlab(value) && getForeMap(x, y) == value) { + placeSlab(x, y, value); } + GameProc.UPD_X = x-8; + GameProc.UPD_Y = y-8; + GameProc.DO_UPD = true; } public void placeToBackground(int x, int y, int value) { diff --git a/core/src/ru/deadsoftware/cavecraft/game/Items.java b/core/src/ru/deadsoftware/cavecraft/game/Items.java index 9987cbe..cb2f736 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/Items.java +++ b/core/src/ru/deadsoftware/cavecraft/game/Items.java @@ -8,15 +8,19 @@ public class Items { public static ArrayMap BLOCKS = new ArrayMap(); public static boolean isFluid(int bl) { - return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65); + return (bl == 8 || bl == 9 || bl == 60 || bl == 61 || bl == 62 || bl == 63 || bl == 64 || bl == 65 || bl == 66 || bl == 67); } public static boolean isWater(int bl) { - return (bl == 8 || bl == 60 || bl == 61 || bl == 62); + return (bl == 8 || bl == 60 || bl == 61 || bl == 62 || bl == 63); } public static boolean isLava(int bl) { - return (bl == 9 || bl == 63 || bl == 64 || bl == 65); + return (bl == 9 || bl == 64 || bl == 65 || bl == 66 || bl == 67); + } + + public static boolean isSlab(int bl) { + return (bl == 51 || bl == 53 || bl == 54 || bl == 55 || bl == 56 || bl == 58); } public static void loadBlocks() { @@ -141,18 +145,22 @@ public class Items { //59 BLOCKS.put("cactus", new Block(1, 0, 14, 16, 57, true, false, true)); //60 - BLOCKS.put("water_12", new Block(58,false,false,true)); + BLOCKS.put("water_16", new Block(7,false,false,true)); //61 - BLOCKS.put("water_8", new Block(59,false,false,true)); + BLOCKS.put("water_12", new Block(58,false,false,true)); //62 - BLOCKS.put("water_4", new Block(60,false,false,true)); + BLOCKS.put("water_8", new Block(59,false,false,true)); //63 - BLOCKS.put("lava_12", new Block(61,false,false,true)); + BLOCKS.put("water_4", new Block(60,false,false,true)); //64 - BLOCKS.put("lava_8", new Block(62,false,false,true)); + BLOCKS.put("lava_16", new Block(8,false,false,true)); //65 - BLOCKS.put("lava_4", new Block(63,false,false,true)); + BLOCKS.put("lava_12", new Block(61,false,false,true)); //66 + BLOCKS.put("lava_8", new Block(62,false,false,true)); + //67 + BLOCKS.put("lava_4", new Block(63,false,false,true)); + //68 BLOCKS.put("obsidian", new Block(65)); } diff --git a/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java b/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java index 4b4f0e8..bf9eadf 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java +++ b/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java @@ -132,12 +132,38 @@ public class WorldGen { } } } - if (x>2 && x2 && x