v0.4.3: updated some visual effects for plants and grass

This commit is contained in:
Evan Debenham 2016-10-16 18:04:39 -04:00
parent aa741a45b7
commit 80e1182811
4 changed files with 31 additions and 5 deletions

View File

@ -54,14 +54,11 @@ public class Fire extends Blob {
fire = cur[cell] - 1; fire = cur[cell] - 1;
if (fire <= 0 && flamable[cell]) { if (fire <= 0 && flamable[cell]) {
int oldTile = Dungeon.level.map[cell];
Dungeon.level.destroy( cell ); Dungeon.level.destroy( cell );
observe = true; observe = true;
GameScene.updateMap( cell ); GameScene.updateMap( cell );
if (Dungeon.visible[cell]) {
GameScene.discoverTile( cell, oldTile );
}
} }
} else { } else {

View File

@ -739,7 +739,7 @@ public abstract class Level implements Bundlable {
plant = seed.couch( pos ); plant = seed.couch( pos );
plants.put( pos, plant ); plants.put( pos, plant );
GameScene.updateMap( pos ); GameScene.plantSeed( pos );
return plant; return plant;
} }

View File

@ -687,6 +687,12 @@ public class GameScene extends PixelScene {
} }
} }
public static void plantSeed( int cell ) {
if (scene != null) {
scene.terrainFeatures.growPlant( cell );
}
}
public static void discoverTile( int pos, int oldValue ) { public static void discoverTile( int pos, int oldValue ) {
if (scene != null) { if (scene != null) {
scene.tiles.discover( pos, oldValue ); scene.tiles.discover( pos, oldValue );

View File

@ -22,16 +22,22 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.Tilemap; 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.PathFinder;
import com.watabou.utils.PointF;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import com.watabou.utils.SparseArray; 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 //TODO add in a proper set of vfx for plants growing/withering, grass burning, discovering traps
public class TerrainFeaturesTilemap extends Tilemap { public class TerrainFeaturesTilemap extends Tilemap {
@ -123,6 +129,23 @@ public class TerrainFeaturesTilemap extends Tilemap {
return img; 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 @Override
public boolean overlapsPoint( float x, float y ) { public boolean overlapsPoint( float x, float y ) {
return true; return true;