v0.5.0b: implemented a second layer of custom tiles for walls
This commit is contained in:
parent
20e3297e74
commit
7fa102e78d
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.5 KiB |
|
@ -145,6 +145,7 @@ public abstract class Level implements Bundlable {
|
|||
public SparseArray<Plant> plants;
|
||||
public SparseArray<Trap> traps;
|
||||
public HashSet<CustomTiledVisual> customTiles;
|
||||
public HashSet<CustomTiledVisual> customWalls;
|
||||
|
||||
protected ArrayList<Item> itemsToSpawn = new ArrayList<>();
|
||||
|
||||
|
@ -168,6 +169,7 @@ public abstract class Level implements Bundlable {
|
|||
private static final String PLANTS = "plants";
|
||||
private static final String TRAPS = "traps";
|
||||
private static final String CUSTOM_TILES= "customTiles";
|
||||
private static final String CUSTOM_WALLS= "customWalls";
|
||||
private static final String MOBS = "mobs";
|
||||
private static final String BLOBS = "blobs";
|
||||
private static final String FEELING = "feeling";
|
||||
|
@ -269,6 +271,7 @@ public abstract class Level implements Bundlable {
|
|||
plants = new SparseArray<>();
|
||||
traps = new SparseArray<>();
|
||||
customTiles = new HashSet<>();
|
||||
customWalls = new HashSet<>();
|
||||
|
||||
} while (!build());
|
||||
decorate();
|
||||
|
@ -319,6 +322,7 @@ public abstract class Level implements Bundlable {
|
|||
plants = new SparseArray<>();
|
||||
traps = new SparseArray<>();
|
||||
customTiles = new HashSet<>();
|
||||
customWalls = new HashSet<>();
|
||||
|
||||
map = bundle.getIntArray( MAP );
|
||||
|
||||
|
@ -391,6 +395,12 @@ public abstract class Level implements Bundlable {
|
|||
customTiles.add(vis);
|
||||
}
|
||||
}
|
||||
|
||||
collection = bundle.getCollection( CUSTOM_WALLS );
|
||||
for (Bundlable p : collection) {
|
||||
CustomTiledVisual vis = (CustomTiledVisual)p;
|
||||
customWalls.add(vis);
|
||||
}
|
||||
|
||||
collection = bundle.getCollection( MOBS );
|
||||
for (Bundlable m : collection) {
|
||||
|
@ -429,6 +439,7 @@ public abstract class Level implements Bundlable {
|
|||
bundle.put( PLANTS, plants.values() );
|
||||
bundle.put( TRAPS, traps.values() );
|
||||
bundle.put( CUSTOM_TILES, customTiles );
|
||||
bundle.put( CUSTOM_WALLS, customWalls );
|
||||
bundle.put( MOBS, mobs );
|
||||
bundle.put( BLOBS, blobs.values() );
|
||||
bundle.put( FEELING, feeling );
|
||||
|
|
|
@ -345,6 +345,11 @@ public class PrisonBossLevel extends Level {
|
|||
customTiles.add(vis);
|
||||
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
|
||||
|
||||
vis = new exitVisualWalls();
|
||||
vis.pos(11, 8);
|
||||
customWalls.add(vis);
|
||||
((GameScene)ShatteredPixelDungeon.scene()).addCustomWall(vis);
|
||||
|
||||
Dungeon.hero.interrupt();
|
||||
Dungeon.hero.pos = 5+27*32;
|
||||
Dungeon.hero.sprite.interruptMotion();
|
||||
|
@ -543,7 +548,6 @@ public class PrisonBossLevel extends Level {
|
|||
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
public exitVisual() {
|
||||
|
@ -553,7 +557,7 @@ public class PrisonBossLevel extends Level {
|
|||
@Override
|
||||
public CustomTiledVisual create() {
|
||||
tileW = 12;
|
||||
tileH = 15;
|
||||
tileH = 14;
|
||||
mapSimpleImage(0, 0);
|
||||
return super.create();
|
||||
}
|
||||
|
@ -570,4 +574,40 @@ public class PrisonBossLevel extends Level {
|
|||
return render[pos] != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class exitVisualWalls extends CustomTiledVisual {
|
||||
private static short[] render = new short[]{
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
public exitVisualWalls() {
|
||||
super(Assets.PRISON_EXIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomTiledVisual create() {
|
||||
tileW = 12;
|
||||
tileH = 14;
|
||||
mapSimpleImage(4, 0);
|
||||
return super.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needsRender(int pos) {
|
||||
return render[pos] != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public class GameScene extends PixelScene {
|
|||
private Group terrain;
|
||||
private Group customTiles;
|
||||
private Group levelVisuals;
|
||||
private Group customWalls;
|
||||
private Group ripples;
|
||||
private Group plants;
|
||||
private Group traps;
|
||||
|
@ -238,6 +239,13 @@ public class GameScene extends PixelScene {
|
|||
walls = new DungeonWallsTilemap();
|
||||
add(walls);
|
||||
|
||||
customWalls = new Group();
|
||||
add(customWalls);
|
||||
|
||||
for( CustomTiledVisual visual : Dungeon.level.customWalls){
|
||||
addCustomWall(visual);
|
||||
}
|
||||
|
||||
wallBlocking = new WallBlockingTilemap();
|
||||
add (wallBlocking);
|
||||
|
||||
|
@ -538,6 +546,10 @@ public class GameScene extends PixelScene {
|
|||
public void addCustomTile( CustomTiledVisual visual){
|
||||
customTiles.add( visual.create() );
|
||||
}
|
||||
|
||||
public void addCustomWall( CustomTiledVisual visual){
|
||||
customWalls.add( visual.create() );
|
||||
}
|
||||
|
||||
private void addHeapSprite( Heap heap ) {
|
||||
ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class );
|
||||
|
|
Loading…
Reference in New Issue
Block a user