summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e14d8af)
raw | patch | inline | side by side (parent: e14d8af)
author | fred-boy <fred-boy@protonmail.com> | |
Wed, 25 Apr 2018 16:04:18 +0000 (23:04 +0700) | ||
committer | fred-boy <fred-boy@protonmail.com> | |
Wed, 25 Apr 2018 16:04:18 +0000 (23:04 +0700) |
Clean up
diff --git a/android/assets/gamelogo_s.png b/android/assets/gamelogo_s.png
deleted file mode 100644 (file)
index e91b200..0000000
Binary files a/android/assets/gamelogo_s.png and /dev/null differ
index e91b200..0000000
Binary files a/android/assets/gamelogo_s.png and /dev/null differ
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInput.java b/core/src/ru/deadsoftware/cavecraft/game/GameInput.java
index e177f40cf043e410458884c8b316650f99a56638..2e54ad3ee1f29f921b34331a45593ce4255f82cd 100644 (file)
}
} else if (CaveGame.STATE == AppState.GAME_CREATIVE_INV) {
CaveGame.STATE = AppState.GAME_PLAY;
+ } else {
+ gameProc.touchDownTime = TimeUtils.millis();
+ gameProc.isTouchDown = true;
+ gameProc.touchDownButton = button;
}
gameProc.touchDownX = screenX;
gameProc.touchDownY = screenY;
- gameProc.touchDownTime = TimeUtils.millis();
- gameProc.isTouchDown = true;
- gameProc.touchDownButton = button;
}
public void touchUp(int screenX, int screenY, int button) {
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java
index 38c79f1641b3e335ab2838ba80a873d58998fa03..7ab146b7235c7342b0a61b56e6bd2b98e4218a9d 100644 (file)
float y = camera.viewportHeight/2-Assets.creativeInv.getRegionHeight()/2;
spriteBatch.draw(Assets.creativeInv, x, y);
spriteBatch.draw(Assets.creativeScroll, x+156,
- y+18+(gameProc.creativeScroll*(72/(gameProc.maxCreativeScroll+1))));
+ y+18+(gameProc.creativeScroll*(72/gameProc.maxCreativeScroll)));
for (int i=gameProc.creativeScroll*40; i<(gameProc.creativeScroll+1)*40; i++) {
if (i>0 && i<Items.BLOCKS.size)
spriteBatch.draw(Assets.blockTextures[Items.BLOCKS.getValueAt(i).getTexture()],
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameSaver.java b/core/src/ru/deadsoftware/cavecraft/game/GameSaver.java
index 2b5b906d877a3dadcd77baca27e1e346d8eeeff1..aab81f54ecb26d101c315e0fbe8c98bd4dab1e8f 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
-import com.badlogic.gdx.utils.ArrayMap;
import ru.deadsoftware.cavecraft.CaveGame;
import java.io.*;
loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav")),
loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"))
);
- gameProc.world.metaMap = new ArrayMap<String, Integer>();
gameProc.physics = new GamePhysics(gameProc);
gameProc.resetRenderer();
} catch (Exception e) {
diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java b/core/src/ru/deadsoftware/cavecraft/game/GameWorld.java
index 5f5a407d44a68c03e23a7ddeb848c61dd3abb26d..4a14c7123f7935203a6206f9ff5559475a20e862 100644 (file)
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
-import com.badlogic.gdx.utils.ArrayMap;
public class GameWorld {
private int WIDTH, HEIGHT;
-
- public ArrayMap<String, Integer> metaMap;
private int[][] foreMap;
private int[][] backMap;
return backMap;
}
+ private int transformX(int x) {
+ x = x%getWidth();
+ if (x<0) x=getWidth()-Math.abs(x);
+ return x;
+ }
+
public int getForeMap(int x, int y) {
int map = 0;
try {
- x = x%getWidth();
- if (x<0) x=getWidth()-Math.abs(x);
+ x = transformX(x);
map = foreMap[x][y];
} catch (ArrayIndexOutOfBoundsException e) {
Gdx.app.error("GameWorld",e.toString());
public void setForeMap(int x, int y, int value) {
try {
- x = x%getWidth();
- if (x<0) x=getWidth()-Math.abs(x);
+ x = transformX(x);
foreMap[x][y] = value;
} catch (ArrayIndexOutOfBoundsException e) {
Gdx.app.error("GameWorld", e.toString());
public int getBackMap(int x, int y) {
int map = 0;
try {
- x = x%getWidth();
- if (x<0) x=getWidth()-Math.abs(x);
+ x = transformX(x);
map = backMap[x][y];
} catch (ArrayIndexOutOfBoundsException e) {
Gdx.app.error("GameWorld",e.toString());
public void setBackMap(int x, int y, int value) {
try {
- x = x%getWidth();
- if (x<0) x=getWidth()-Math.abs(x);
+ x = transformX(x);
backMap[x][y] = value;
} catch (ArrayIndexOutOfBoundsException e) {
Gdx.app.error("GameWorld", e.toString());
}
}
- public int getMeta(int x, int y) {
- if (metaMap.containsKey(x+"_"+y)) return metaMap.get(x+"_"+y);
- else return 0;
- }
-
- public void setMeta(int x, int y, int value) {
- if (metaMap.containsKey(x+"_"+y)) metaMap.removeKey(x+"_"+y);
- metaMap.put(x+"_"+y, value);
- }
-
public void placeToForeground(int x, int y, int value) {
if (getForeMap(x,y) == 0 || value == 0) {
- setForeMap(x,y,value);
+ setForeMap(x, y, value);
}
}
public void placeToBackground(int x, int y, int value) {
- if (value==0 || (getBackMap(x,y) == 0 && !Items.BLOCKS.getValueAt(value).background)) {
+ if (value==0 || (getBackMap(x,y) == 0 && Items.BLOCKS.getValueAt(value).collision)) {
setBackMap(x,y,value);
}
}
WorldGen.genWorld(WIDTH,HEIGHT);
foreMap = WorldGen.getForeMap();
backMap = WorldGen.getBackMap();
- metaMap = new ArrayMap<String, Integer>();
WorldGen.clear();
}
diff --git a/core/src/ru/deadsoftware/cavecraft/game/Items.java b/core/src/ru/deadsoftware/cavecraft/game/Items.java
index 93b9a1f8ee1bb03b62646ef09912a960e58cd954..6d49b5d16f655d1bf8c37ca574fb3c6628715077 100644 (file)
import com.badlogic.gdx.utils.ArrayMap;
import ru.deadsoftware.cavecraft.game.objects.Block;
-import ru.deadsoftware.cavecraft.misc.Assets;
public class Items {
BLOCKS.put("lapis_block", new Block(19));
BLOCKS.put("sandstone", new Block(20));
BLOCKS.put("noteblock", new Block(21));
- BLOCKS.put("bed", new Block(0,8,16,8,22,false,true,true));
+ BLOCKS.put("bed_l", new Block(22,false,true,true));
+ BLOCKS.put("bed_r", new Block(23, false,true, true));
BLOCKS.put("cobweb", new Block(24,false,false,true));
BLOCKS.put("tallgrass", new Block(25,false,false,true));
BLOCKS.put("deadbush", new Block(26,false,false,true));
BLOCKS.put("rose", new Block(29,false,false,true));
BLOCKS.put("brown_mushroom", new Block(30,false,false,true));
BLOCKS.put("red_mushroom", new Block(31,false,false,true));
- BLOCKS.put("wool", new Block(32,false,true,false));
+ BLOCKS.put("wool_while", new Block(32,true,false,false));
+ BLOCKS.put("wool_orange", new Block(33,true,false,false));
+ BLOCKS.put("wool_magenta", new Block(34,true,false,false));
+ BLOCKS.put("wool_lightblue", new Block(35,true,false,false));
+ BLOCKS.put("wool_yellow", new Block(36,true,false,false));
+ BLOCKS.put("wool_lime", new Block(37,true,false,false));
+ BLOCKS.put("wool_pink", new Block(38,true,false,false));
+ BLOCKS.put("wool_gray", new Block(39,true,false,false));
+ BLOCKS.put("wool_lightgray", new Block(40,true,false,false));
+ BLOCKS.put("wool_cyan", new Block(41,true,false,false));
+ BLOCKS.put("wool_purple", new Block(42,true,false,false));
+ BLOCKS.put("wool_blue", new Block(43,true,false,false));
+ BLOCKS.put("wool_brown", new Block(44,true,false,false));
+ BLOCKS.put("wool_green", new Block(45,true,false,false));
+ BLOCKS.put("wool_red", new Block(46,true,false,false));
+ BLOCKS.put("wool_black", new Block(47,true,false,false));
}
public static void load() {
diff --git a/core/src/ru/deadsoftware/cavecraft/misc/Assets.java b/core/src/ru/deadsoftware/cavecraft/misc/Assets.java
index 28f3508d8172b12110ddd5ca6972d9bf2e65e6bd..87e04af1f6eb5c6ed8521b21b1fca78fc86982e0 100644 (file)
public class Assets {
- public static final int BLOCK_TEXTURES = 47;
+ public static final int BLOCK_TEXTURES = 48;
private static GlyphLayout layout;