v0.8.1: added a slight delay to checked cell vfx based on distance

This commit is contained in:
Evan Debenham 2020-06-04 17:48:07 -04:00
parent 4a302a6079
commit 985b20ebff
3 changed files with 15 additions and 4 deletions

View File

@ -1719,7 +1719,7 @@ public class Hero extends Char {
if (fieldOfView[p] && p != pos) { if (fieldOfView[p] && p != pos) {
if (intentional) { if (intentional) {
sprite.parent.addToBack( new CheckedCell( p ) ); sprite.parent.addToBack(new CheckedCell(p, pos));
} }
if (Dungeon.level.secret[p]){ if (Dungeon.level.secret[p]){

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.effects; package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.watabou.gltextures.TextureCache; import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
@ -29,6 +30,7 @@ import com.watabou.noosa.Image;
public class CheckedCell extends Image { public class CheckedCell extends Image {
private float alpha; private float alpha;
private float delay;
public CheckedCell( int pos ) { public CheckedCell( int pos ) {
super( TextureCache.createSolid( 0xFF55AAFF ) ); super( TextureCache.createSolid( 0xFF55AAFF ) );
@ -41,10 +43,19 @@ public class CheckedCell extends Image {
alpha = 0.8f; alpha = 0.8f;
} }
public CheckedCell( int pos, int visSource ) {
this( pos );
delay = (Dungeon.level.trueDistance(pos, visSource)-1f);
//steadily accelerates as distance increases
if (delay > 0) delay = (float)Math.pow(delay, 0.75f)/10f;
}
@Override @Override
public void update() { public void update() {
if ((alpha -= Game.elapsed) > 0) { if ((delay -= Game.elapsed) > 0){
alpha( 0 );
} else if ((alpha -= Game.elapsed) > 0) {
alpha( alpha ); alpha( alpha );
scale.set( DungeonTilemap.SIZE * alpha ); scale.set( DungeonTilemap.SIZE * alpha );
} else { } else {

View File

@ -61,8 +61,8 @@ public class StoneOfClairvoyance extends Runestone {
right = Math.min(Dungeon.level.width()-1, c.x + c.x - left); right = Math.min(Dungeon.level.width()-1, c.x + c.x - left);
left = Math.max(0, left); left = Math.max(0, left);
for (curr = left + y * Dungeon.level.width(); curr <= right + y * Dungeon.level.width(); curr++){ for (curr = left + y * Dungeon.level.width(); curr <= right + y * Dungeon.level.width(); curr++){
curUser.sprite.parent.addToBack( new CheckedCell( curr ) ); curUser.sprite.parent.addToBack( new CheckedCell( curr, cell ) );
Dungeon.level.mapped[curr] = true; Dungeon.level.mapped[curr] = true;
if (Dungeon.level.secret[curr]) { if (Dungeon.level.secret[curr]) {