Implemented elevation in editor and mechanically in-game

This commit is contained in:
Anuken
2018-06-11 15:18:25 -04:00
parent cbd83b5e39
commit b609b5909b
25 changed files with 534 additions and 376 deletions
@@ -6,12 +6,13 @@ import io.anuke.ucore.util.Bits;
import java.nio.ByteBuffer;
public class MapTileData {
/**Tile size: 3 bytes. <br>
/**Tile size: 4 bytes. <br>
* 0: ground tile <br>
* 1: wall tile <br>
* 2: rotation + team <br>
* 3: link (x/y) <br>*/
private final static int TILE_SIZE = 4;
* 3: link (x/y) <br>
* 4: elevation <br>*/
private final static int TILE_SIZE = 5;
private final ByteBuffer buffer;
private final int width, height;
@@ -91,7 +92,7 @@ public class MapTileData {
}
public enum DataPosition{
floor, wall, link, rotationTeam
floor, wall, link, rotationTeam, elevation
}
public class TileDataMarker {
@@ -99,12 +100,14 @@ public class MapTileData {
public byte link;
public byte rotation;
public byte team;
public byte elevation;
public void read(ByteBuffer buffer){
floor = buffer.get();
wall = buffer.get();
link = buffer.get();
byte rt = buffer.get();
elevation = buffer.get();
rotation = Bits.getLeftByte(rt);
team = Bits.getRightByte(rt);
@@ -120,6 +123,7 @@ public class MapTileData {
buffer.put(wall);
buffer.put(link);
buffer.put(Bits.packByte(rotation, team));
buffer.put(elevation);
}
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ import static io.anuke.mindustry.Vars.*;
public class Maps implements Disposable{
/**List of all built-in maps.*/
private static final String[] defaultMapNames = {"test"};
private static final String[] defaultMapNames = {};
/**Tile format version.*/
private static final int version = 0;