v0.7.5: game camera now pans instead of snapping in most cases

This commit is contained in:
Evan Debenham
2019-09-16 00:00:09 -04:00
parent 09dd4dd053
commit f808e201f3
8 changed files with 48 additions and 23 deletions

View File

@@ -224,8 +224,9 @@ public class Notes {
k = (KeyRecord) records.get(records.indexOf(k));
k.quantity(k.quantity() - key.quantity());
if (k.quantity() <= 0){
return records.remove(k);
records.remove(k);
}
return true;
}
return false;
}

View File

@@ -160,8 +160,6 @@ public class CellSelector extends PointerArea {
@Override
protected void onDrag( PointerEvent event ) {
camera.target = null;
if (pinching) {
@@ -180,7 +178,7 @@ public class CellSelector extends PointerArea {
lastPos.set( event.current );
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, event.current ).invScale( camera.zoom ) );
camera.shift( PointF.diff( lastPos, event.current ).invScale( camera.zoom ) );
lastPos.set( event.current );
}
}

View File

@@ -413,7 +413,7 @@ public class GameScene extends PixelScene {
Dungeon.hero.next();
Camera.main.target = hero;
Camera.main.snapTo(hero.center());
if (InterlevelScene.mode != InterlevelScene.Mode.NONE) {
if (Dungeon.depth == Statistics.deepestFloor

View File

@@ -96,7 +96,7 @@ public class HeroSprite extends CharSprite {
@Override
public void place( int p ) {
super.place( p );
Camera.main.target = this;
Camera.main.panTo(center(), 5f);
}
@Override
@@ -105,7 +105,7 @@ public class HeroSprite extends CharSprite {
if (ch.flying) {
play( fly );
}
Camera.main.target = this;
Camera.main.panFollow(this, 5f);
}
@Override

View File

@@ -105,8 +105,7 @@ public class DangerIndicator extends Tag {
TargetHealthIndicator.instance.target(target == TargetHealthIndicator.instance.target() ? null : target);
if (Dungeon.hero.curAction == null) {
Camera.main.target = null;
Camera.main.focusOn(target.sprite);
Camera.main.panTo(target.sprite.center(), 5f);
}
}
}

View File

@@ -140,7 +140,7 @@ public class ScrollPane extends Component {
Camera c = content.camera;
c.scroll.offset( PointF.diff( lastPos, event.current ).invScale( c.zoom ) );
c.shift( PointF.diff( lastPos, event.current ).invScale( c.zoom ) );
if (c.scroll.x + width > content.width()) {
c.scroll.x = content.width() - width;
}

View File

@@ -86,9 +86,7 @@ public class StatusPane extends Component {
@Override
protected void onClick( PointerEvent event ) {
Image sprite = Dungeon.hero.sprite;
if (!sprite.isVisible()) {
Camera.main.focusOn( sprite );
}
Camera.main.panTo( sprite.center(), 2f );
GameScene.show( new WndHero() );
}
} );