v3.1.0: fixed camera following enemies after teleport in specific cases

This commit is contained in:
Evan Debenham
2025-05-31 19:12:15 -04:00
committed by Evan Debenham
parent f599bba4c0
commit 8c3a94037c
2 changed files with 10 additions and 0 deletions

View File

@@ -269,6 +269,10 @@ public class Camera extends Gizmo {
panIntensity = intensity;
}
public synchronized Visual followTarget(){
return followTarget;
}
public synchronized void setFollowDeadzone( float deadzone ){
followDeadzone = deadzone;
}

View File

@@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.Camera;
import com.watabou.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
@@ -299,6 +300,11 @@ public class ScrollOfTeleportation extends Scroll {
if (Dungeon.level.heroFOV[pos] || ch == Dungeon.hero ) {
ch.sprite.emitter().start(Speck.factory(Speck.LIGHT), 0.2f, 3);
} else {
if (Camera.main.followTarget() == ch.sprite){
//clear the follow in this case as the teleport target is going out of vision
Camera.main.panFollow(null, 5f);
}
}
}