v0.7.5: added support for more dynamic custom tilemaps
This commit is contained in:
@@ -753,6 +753,15 @@ public class GameScene extends PixelScene {
|
||||
if (scene != null) scene.healthIndicators.add(indicator);
|
||||
}
|
||||
|
||||
public static void add( CustomTilemap t, boolean wall ){
|
||||
if (scene == null) return;
|
||||
if (wall){
|
||||
scene.addCustomWall(t);
|
||||
} else {
|
||||
scene.addCustomTile(t);
|
||||
}
|
||||
}
|
||||
|
||||
public static void effect( Visual effect ) {
|
||||
scene.effects.add( effect );
|
||||
}
|
||||
|
||||
+9
-2
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.tiles;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.NoosaScript;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.watabou.noosa.Tilemap;
|
||||
import com.watabou.utils.Bundlable;
|
||||
@@ -36,7 +37,7 @@ public abstract class CustomTilemap implements Bundlable {
|
||||
public int tileW = 1, tileH = 1; //width and height in tiles
|
||||
|
||||
protected Object texture;
|
||||
private Tilemap vis = null;
|
||||
protected Tilemap vis = null;
|
||||
|
||||
public void pos(int pos) {
|
||||
pos( pos%Dungeon.level.width(), pos/Dungeon.level.width() );
|
||||
@@ -82,7 +83,13 @@ public abstract class CustomTilemap implements Bundlable {
|
||||
|
||||
public Tilemap create(){
|
||||
if (vis != null && vis.alive) vis.killAndErase();
|
||||
vis = new Tilemap(texture, new TextureFilm( texture, SIZE, SIZE ));
|
||||
vis = new Tilemap(texture, new TextureFilm( texture, SIZE, SIZE )){
|
||||
@Override
|
||||
protected NoosaScript script() {
|
||||
//allow lighting for custom tilemaps
|
||||
return NoosaScript.get();
|
||||
}
|
||||
};
|
||||
vis.x = tileX*SIZE;
|
||||
vis.y = tileY*SIZE;
|
||||
return vis;
|
||||
|
||||
Reference in New Issue
Block a user