v0.8.0: fixed various errors with resized enemy sprites

This commit is contained in:
Evan Debenham 2019-10-29 19:51:00 -04:00
parent c803537ecd
commit 1539d57f71
4 changed files with 12 additions and 12 deletions

View File

@ -138,12 +138,12 @@ public class Visual extends Gizmo {
}
public PointF center() {
return new PointF( x + width / 2, y + height / 2 );
return new PointF( x + width() / 2, y + height() / 2 );
}
public PointF center( PointF p ) {
x = p.x - width / 2;
y = p.y - height / 2;
x = p.x - width() / 2;
y = p.y - height() / 2;
return p;
}

View File

@ -166,8 +166,8 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
final int csize = DungeonTilemap.SIZE;
return new PointF(
PixelScene.align(Camera.main, ((cell % Dungeon.level.width()) + 0.5f) * csize - width * 0.5f),
PixelScene.align(Camera.main, ((cell / Dungeon.level.width()) + 1.0f) * csize - height - csize * perspectiveRaise)
PixelScene.align(Camera.main, ((cell % Dungeon.level.width()) + 0.5f) * csize - width() * 0.5f),
PixelScene.align(Camera.main, ((cell / Dungeon.level.width()) + 1.0f) * csize - height() - csize * perspectiveRaise)
);
}
@ -586,8 +586,8 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
super.updateMatrix();
Matrix.copy(matrix, shadowMatrix);
Matrix.translate(shadowMatrix,
(width() * (1f - shadowWidth)) / 2f,
(height() * (1f - shadowHeight)) + shadowOffset);
(width * (1f - shadowWidth)) / 2f,
(height * (1f - shadowHeight)) + shadowOffset);
Matrix.scale(shadowMatrix, shadowWidth, shadowHeight);
}

View File

@ -42,7 +42,7 @@ public class TargetHealthIndicator extends HealthBar {
if (target != null && target.isAlive() && target.sprite.visible) {
CharSprite sprite = target.sprite;
width = sprite.width;
width = sprite.width();
x = sprite.x;
y = sprite.y - 3;
level( target );

View File

@ -68,14 +68,14 @@ public class WndInfoMob extends WndTitledMessage {
protected void layout() {
image.x = 0;
image.y = Math.max( 0, name.height() + health.height() - image.height );
image.y = Math.max( 0, name.height() + health.height() - image.height() );
name.setPos(x + image.width + GAP,
image.height > name.height() ? y +(image.height() - name.height()) / 2 : y);
image.height() > name.height() ? y +(image.height() - name.height()) / 2 : y);
float w = width - image.width - GAP;
float w = width - image.width() - GAP;
health.setRect(image.width + GAP, name.bottom() + GAP, w, health.height());
health.setRect(image.width() + GAP, name.bottom() + GAP, w, health.height());
buffs.setPos(
name.right() + GAP-1,