diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java index 5316cdc0c..e10fc64b8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Fire.java @@ -54,14 +54,11 @@ public class Fire extends Blob { fire = cur[cell] - 1; if (fire <= 0 && flamable[cell]) { - int oldTile = Dungeon.level.map[cell]; Dungeon.level.destroy( cell ); observe = true; GameScene.updateMap( cell ); - if (Dungeon.visible[cell]) { - GameScene.discoverTile( cell, oldTile ); - } + } } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 583749376..3f089e5f8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -739,7 +739,7 @@ public abstract class Level implements Bundlable { plant = seed.couch( pos ); plants.put( pos, plant ); - GameScene.updateMap( pos ); + GameScene.plantSeed( pos ); return plant; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 2e4b8c1aa..2efd866ac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -686,6 +686,12 @@ public class GameScene extends PixelScene { scene.terrainFeatures.updateMapCell( cell ); } } + + public static void plantSeed( int cell ) { + if (scene != null) { + scene.terrainFeatures.growPlant( cell ); + } + } public static void discoverTile( int pos, int oldValue ) { if (scene != null) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TerrainFeaturesTilemap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TerrainFeaturesTilemap.java index a920ffce7..296627446 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TerrainFeaturesTilemap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/TerrainFeaturesTilemap.java @@ -22,16 +22,22 @@ package com.shatteredpixel.shatteredpixeldungeon.ui; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.watabou.noosa.Image; import com.watabou.noosa.TextureFilm; import com.watabou.noosa.Tilemap; +import com.watabou.noosa.tweeners.AlphaTweener; +import com.watabou.noosa.tweeners.ScaleTweener; import com.watabou.utils.PathFinder; +import com.watabou.utils.PointF; import com.watabou.utils.Random; import com.watabou.utils.SparseArray; +import static com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap.tileToWorld; + //TODO add in a proper set of vfx for plants growing/withering, grass burning, discovering traps public class TerrainFeaturesTilemap extends Tilemap { @@ -123,6 +129,23 @@ public class TerrainFeaturesTilemap extends Tilemap { return img; } + public void growPlant( final int pos ){ + final Image plant = tile( pos, map[pos] ); + plant.origin.set( 8, 12 ); + plant.scale.set( 0 ); + plant.point( DungeonTilemap.tileToWorld( pos ) ); + + parent.add( plant ); + + parent.add( new ScaleTweener( plant, new PointF(1, 1), 0.2f ) { + protected void onComplete() { + plant.killAndErase(); + killAndErase(); + updateMapCell(pos); + } + } ); + } + @Override public boolean overlapsPoint( float x, float y ) { return true;