Java Code Examples for com.watabou.noosa.Tilemap#map()
The following examples show how to use
com.watabou.noosa.Tilemap#map() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewCavesBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; int entryPos = 0; for (int i = 0; i < data.length; i++){ //copy over this row of the entryway if (i % tileW == tileW/2 - 2){ data[i++] = entryWay[entryPos++]; data[i++] = entryWay[entryPos++]; data[i++] = entryWay[entryPos++]; data[i++] = entryWay[entryPos++]; data[i] = entryWay[entryPos++]; } else { data[i] = -1; } } v.map( data, tileW ); return v; }
Example 2
Source File: VariativeDungeonTilemap.java From remixed-dungeon with GNU General Public License v3.0 | 6 votes |
public VariativeDungeonTilemap(Level level, String tiles) { super(level, tiles); this.level = level; int mSize = level.getWidth() * level.getHeight(); try { String tilemapConfig = "tilemapDesc/" + tiles.replace(".png", ".json"); if (!ModdingMode.isResourceExist(tilemapConfig)) { tilemapConfig = "tilemapDesc/tiles_x_default.json"; } xTilemapConfiguration = XTilemapConfiguration.readConfig(tilemapConfig); } catch (JSONException e) { throw ModdingMode.modException(e); } data = new int[level.getWidth()*level.getHeight()]; map(buildGroundMap(),level.getWidth()); mDecoLayer = new Tilemap(tiles, new TextureFilm(tiles, SIZE, SIZE)); mDecoMap = new int[mSize]; mDecoLayer.map(buildDecoMap(), level.getWidth()); }
Example 3
Source File: NewPrisonBossLevel.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 6 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; int cell; Trap t; int i = 0; for (int y = tileY; y < tileY + tileH; y++){ cell = tileX + y*Dungeon.level.width(); for (int x = tileX; x < tileX + tileW; x++){ t = Dungeon.level.traps.get(cell); if (t != null){ data[i] = t.color + t.shape*16; } else { data[i] = -1; } cell++; i++; } } v.map( data, tileW ); setFade(); return v; }
Example 4
Source File: NewPrisonBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 6 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; int cell; Trap t; int i = 0; for (int y = tileY; y < tileY + tileH; y++){ cell = tileX + y*Dungeon.level.width(); for (int x = tileX; x < tileX + tileW; x++){ t = Dungeon.level.traps.get(cell); if (t != null){ data[i] = t.color + t.shape*16; } else { data[i] = -1; } cell++; i++; } } v.map( data, tileW ); setFade(); return v; }
Example 5
Source File: MassGraveRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; for (int i = 0; i < data.length; i++){ if (i < tileW) data[i] = WALL_OVERLAP; else data[i] = FLOOR; } v.map( data, tileW ); return v; }
Example 6
Source File: NewPrisonBossLevel.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = mapSimpleImage(0, 0, TEX_WIDTH); for (int i = 0; i < data.length; i++){ if (render[i] == 0) data[i] = -1; } v.map(data, tileW); return v; }
Example 7
Source File: MassGraveRoom.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; for (int i = 0; i < data.length; i++){ if (i < tileW) data[i] = WALL_OVERLAP; else data[i] = FLOOR; } v.map( data, tileW ); return v; }
Example 8
Source File: DemonSpawnerRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int cell = tileX + tileY * Dungeon.level.width(); int[] map = Dungeon.level.map; int[] data = new int[tileW*tileH]; for (int i = 0; i < data.length; i++){ if (i % tileW == 0){ cell = tileX + (tileY + i / tileW) * Dungeon.level.width(); } if (Dungeon.level.findMob(cell) instanceof DemonSpawner){ data[i-1] = 5 + 4*8; data[i] = 6 + 4*8; data[i+1] = 7 + 4*8; i++; cell++; } else if (map[cell] == Terrain.EMPTY_DECO) { if (Statistics.amuletObtained){ data[i] = 31; } else { data[i] = 27; } } else { data[i] = 19; } cell++; } v.map( data, tileW ); return v; }
Example 9
Source File: OldPrisonBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = mapSimpleImage(4, 0, TEX_WIDTH); for (int i = 0; i < data.length; i++){ if (render[i] == 0) data[i] = -1; } v.map(data, tileW); return v; }
Example 10
Source File: NewPrisonBossLevel.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = mapSimpleImage(0, 10, TEX_WIDTH); for (int i = 0; i < data.length; i++){ if (render[i] == 0) data[i] = -1; } v.map(data, tileW); return v; }
Example 11
Source File: OldPrisonBossLevel.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 5 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = mapSimpleImage(4, 0, TEX_WIDTH); for (int i = 0; i < data.length; i++){ if (render[i] == 0) data[i] = -1; } v.map(data, tileW); return v; }
Example 12
Source File: SewerBossExitRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map(layout, 3); return v; }
Example 13
Source File: SewerBossExitRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map(layout, 3); return v; }
Example 14
Source File: NewCityBossLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; int[] map = Dungeon.level.map; int shadowTop = -1; //upper part of the level, mostly demon halls tiles for (int i = tileW; i < tileW*21; i++) { if (map[i] == Terrain.EXIT && shadowTop == -1){ shadowTop = i - tileW*4; } //pillars if (map[i] == Terrain.CHASM && map[i+tileW] == Terrain.WALL) { data[i] = 12*8 + 6; data[++i] = 12*8 + 7; } else if (map[i] == Terrain.WALL && map[i-tileW] == Terrain.CHASM) { data[i] = 13 * 8 + 6; data[++i] = 13 * 8 + 7; //skull tops } else if (map[i+tileW] == Terrain.STATUE) { data[i] = 14*8 + 5; //otherwise no tile here } else { data[i] = -1; } } //custom shadow for stairs for (int i = 0; i < 8; i++){ if (i < 4){ data[shadowTop] = i*8 + 0; data[shadowTop+1] = data[shadowTop+2] = data[shadowTop+3] = data[shadowTop+4] = data[shadowTop+5] = data[shadowTop+6] = i*8 + 1; data[shadowTop+7] = i*8 + 2; } else { int j = i - 4; data[shadowTop] = j*8 + 3; data[shadowTop+1] = data[shadowTop+2] = data[shadowTop+3] = data[shadowTop+4] = data[shadowTop+5] = data[shadowTop+6] = j*8 + 4; data[shadowTop+7] = j*8 + 5; } shadowTop += tileW; } //lower part. Statues and DK's throne for (int i = tileW*21; i < tileW * tileH; i++){ //Statues that need to face left instead of right if (map[i] == Terrain.STATUE && i%tileW > 7){ data[i-tileW] = 14*8 + 4; } else if (map[i] == Terrain.SIGN){ data[i-tileW] = 13*8 + 5; } //always no tile here (as the above statements are modifying previous tiles) data[i] = -1; } v.map( data, tileW ); return v; }
Example 15
Source File: WeakFloorRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map( new int[]{Dungeon.depth/5}, 1); return v; }
Example 16
Source File: LastLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int candlesStart = Dungeon.level.exit - 3 - 3*Dungeon.level.width(); int cell = tileX + tileY * Dungeon.level.width(); int[] map = Dungeon.level.map; int[] data = new int[tileW*tileH]; for (int i = 0; i < data.length; i++){ if (i % tileW == 0){ cell = tileX + (tileY + i / tileW) * Dungeon.level.width(); } if (cell == candlesStart){ for (int candle : CANDLES) { if (data[i] == 0) data[i] = candle; if (data[i] == 46 && DungeonTileSheet.tileVariance[cell] >= 50){ data[i] ++; } if (Statistics.amuletObtained && data[i] > 40){ data[i] += 8; } if (map[cell] != Terrain.CHASM && map[cell+Dungeon.level.width] == Terrain.CHASM) { data[i+tileW] = 6; } i++; cell++; if (i % tileW == 0){ cell = tileX + (tileY + i / tileW) * Dungeon.level.width(); } } } if (map[cell] == Terrain.EMPTY_DECO) { if (Statistics.amuletObtained){ data[i] = 31; } else { data[i] = 27; } } else if (map[cell] == Terrain.EMPTY) { data[i] = 19; } else if (data[i] == 0) { data[i] = -1; } cell++; } v.map( data, tileW ); return v; }
Example 17
Source File: LastLevel.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map(map, tileW); return v; }
Example 18
Source File: GooBossRoom.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); int[] data = new int[tileW*tileH]; for (int x = 0; x < tileW; x++){ for (int y = 0; y < tileH; y++){ //corners if ((x == 0 || x == tileW-1) && (y == 0 || y == tileH-1)){ data[x + tileW*y] = -1; //adjacent to corners } else if ((x == 1 && y == 0) || (x == 0 && y == 1)){ data[x + tileW*y] = 0; } else if ((x == tileW-2 && y == 0) || (x == tileW-1 && y == 1)){ data[x + tileW*y] = 1; } else if ((x == 1 && y == tileH-1) || (x == 0 && y == tileH-2)){ data[x + tileW*y] = 2; } else if ((x == tileW-2 && y == tileH-1) || (x == tileW-1 && y == tileH-2)) { data[x + tileW*y] = 3; //sides } else if (x == 0){ data[x + tileW*y] = 4; } else if (y == 0){ data[x + tileW*y] = 5; } else if (x == tileW-1){ data[x + tileW*y] = 6; } else if (y == tileH-1){ data[x + tileW*y] = 7; //inside } else { data[x + tileW*y] = 8; } } } v.map( data, tileW ); return v; }
Example 19
Source File: RitualSiteRoom.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map(mapSimpleImage(0, 0, TEX_WIDTH), 3); return v; }
Example 20
Source File: SewerBossExitRoom.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
@Override public Tilemap create() { Tilemap v = super.create(); v.map(layout, 3); return v; }