//0 = none //1 = left //2 = up //4 = right //8 = bottom public byte compareTilePos(TilePos tpc, TilePos[] tpa) { byte detected = 0; foreach (TilePos t in tpa) { if (t.x == tpc.x - 1 && t.y == tpc.y) { detected += 1; } else if (t.x == tpc.x + 1 && t.y == tpc.y) { detected += 4; } else if (t.x == tpc.x && t.y == tpc.y - 1) { detected += 2; } else if (t.x == tpc.x && t.y == tpc.y + 1) { detected += 8; } else if (t.x == tpc.x && t.y == tpc.y) { detected += 0x80; } } return(detected); }
public TilePos compareTilePosT(TilePos tpc, TilePos[] tpa) { foreach (TilePos t in tpa) { if (t.x == tpc.x && t.y == tpc.y) { return(t); } } return(null); }