v0.3.0: adjusted dist1 neighbours arrays such that for any given index i, i-1 and i+1 correspond to the adjacent neighbour tiles.

This commit is contained in:
Evan Debenham 2015-04-08 08:57:07 -04:00 committed by Evan Debenham
parent b2f5fd6123
commit 7cce41e650

View File

@ -91,15 +91,15 @@ public abstract class Level implements Bundlable {
WATER, WATER,
GRASS, GRASS,
DARK DARK
}; }
public static final int WIDTH = 32; public static final int WIDTH = 32;
public static final int HEIGHT = 32; public static final int HEIGHT = 32;
public static final int LENGTH = WIDTH * HEIGHT; public static final int LENGTH = WIDTH * HEIGHT;
public static final int[] NEIGHBOURS4 = {-WIDTH, +1, +WIDTH, -1}; public static final int[] NEIGHBOURS4 = {-WIDTH, +1, +WIDTH, -1};
public static final int[] NEIGHBOURS8 = {+1, -1, +WIDTH, -WIDTH, +1+WIDTH, +1-WIDTH, -1+WIDTH, -1-WIDTH}; public static final int[] NEIGHBOURS8 = {-WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH};
public static final int[] NEIGHBOURS9 = {0, +1, -1, +WIDTH, -WIDTH, +1+WIDTH, +1-WIDTH, -1+WIDTH, -1-WIDTH}; public static final int[] NEIGHBOURS9 = {0, -WIDTH, +1-WIDTH, +1, +1+WIDTH, +WIDTH, -1+WIDTH, -1, -1-WIDTH};
//make sure to check insideMap() when using these, as there's a risk something may be outside the map //make sure to check insideMap() when using these, as there's a risk something may be outside the map
public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH, public static final int[] NEIGHBOURS8DIST2 = {+2+2*WIDTH, +1+2*WIDTH, 2*WIDTH, -1+2*WIDTH, -2+2*WIDTH,