v0.3.5: clarity improvements to shielding

This commit is contained in:
Evan Debenham 2016-04-22 03:57:55 -04:00
parent e07f40df48
commit a839392b0f
2 changed files with 21 additions and 14 deletions

View File

@ -51,7 +51,8 @@ public class StatusPane extends Component {
private int lastTier = 0; private int lastTier = 0;
private Image shield; private Image rawShielding;
private Image shieldedHP;
private Image hp; private Image hp;
private Image exp; private Image exp;
@ -103,8 +104,12 @@ public class StatusPane extends Component {
compass = new Compass( Dungeon.level.exit ); compass = new Compass( Dungeon.level.exit );
add( compass ); add( compass );
shield = new Image( Assets.SHLD_BAR ); rawShielding = new Image( Assets.SHLD_BAR );
add(shield); rawShielding.alpha(0.5f);
add(rawShielding);
shieldedHP = new Image( Assets.SHLD_BAR );
add(shieldedHP);
hp = new Image( Assets.HP_BAR ); hp = new Image( Assets.HP_BAR );
add( hp ); add( hp );
@ -151,8 +156,8 @@ public class StatusPane extends Component {
compass.y = avatar.y + avatar.height / 2f - compass.origin.y; compass.y = avatar.y + avatar.height / 2f - compass.origin.y;
PixelScene.align(compass); PixelScene.align(compass);
hp.x = shield.x = 30; hp.x = shieldedHP.x = rawShielding.x = 30;
hp.y = shield.y = 3; hp.y = shieldedHP.y = rawShielding.y = 3;
bossHP.setPos( 6 + (width - bossHP.width())/2, 20); bossHP.setPos( 6 + (width - bossHP.width())/2, 20);
@ -174,12 +179,12 @@ public class StatusPane extends Component {
float health = Dungeon.hero.HP; float health = Dungeon.hero.HP;
float shield = Dungeon.hero.SHLD; float shield = Dungeon.hero.SHLD;
float max = Math.max(health+shield, Dungeon.hero.HT); float max = Dungeon.hero.HT;
if (!Dungeon.hero.isAlive()) { if (!Dungeon.hero.isAlive()) {
avatar.tint( 0x000000, 0.6f ); avatar.tint( 0x000000, 0.6f );
blood.on = false; blood.on = false;
} else if ((health/Dungeon.hero.HT) < 0.25f) { } else if ((health/max) < 0.25f) {
avatar.tint( 0xcc0000, 0.4f ); avatar.tint( 0xcc0000, 0.4f );
blood.on = true; blood.on = true;
} else { } else {
@ -187,8 +192,9 @@ public class StatusPane extends Component {
blood.on = false; blood.on = false;
} }
hp.scale.x = health/max; hp.scale.x = Math.max( 0, (health-shield)/max);
this.shield.scale.x = (health+shield)/max; shieldedHP.scale.x = health/max;
rawShielding.scale.x = shield/max;
exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp(); exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();

View File

@ -44,7 +44,7 @@ import java.util.Locale;
public class WndHero extends WndTabbed { public class WndHero extends WndTabbed {
private static final int WIDTH = 100; private static final int WIDTH = 115;
private StatsTab stats; private StatsTab stats;
private BuffsTab buffs; private BuffsTab buffs;
@ -112,7 +112,7 @@ public class WndHero extends WndTabbed {
GameScene.show( new WndCatalogus() ); GameScene.show( new WndCatalogus() );
} }
}; };
btnCatalogs.setRect( 0, title.height(), btnCatalogs.reqWidth() + 2, btnCatalogs.reqHeight() + 2 ); btnCatalogs.setRect( 0, title.height()+1, 57, btnCatalogs.reqHeight() + 2 );
add( btnCatalogs ); add( btnCatalogs );
RedButton btnJournal = new RedButton( Messages.get(this, "journal") ) { RedButton btnJournal = new RedButton( Messages.get(this, "journal") ) {
@ -124,13 +124,14 @@ public class WndHero extends WndTabbed {
}; };
btnJournal.setRect( btnJournal.setRect(
btnCatalogs.right() + 1, btnCatalogs.top(), btnCatalogs.right() + 1, btnCatalogs.top(),
btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 ); 57, btnJournal.reqHeight() + 2 );
add( btnJournal ); add( btnJournal );
pos = btnCatalogs.bottom() + GAP; pos = btnCatalogs.bottom() + GAP;
statSlot( Messages.get(this, "str"), hero.STR() ); statSlot( Messages.get(this, "str"), hero.STR() );
statSlot( Messages.get(this, "health"), (hero.HP + hero.SHLD) + "/" + hero.HT ); if (hero.SHLD > 0) statSlot( Messages.get(this, "health"), hero.HP + "+" + hero.SHLD + "/" + hero.HT );
else statSlot( Messages.get(this, "health"), (hero.HP) + "/" + hero.HT );
statSlot( Messages.get(this, "exp"), hero.exp + "/" + hero.maxExp() ); statSlot( Messages.get(this, "exp"), hero.exp + "/" + hero.maxExp() );
pos += GAP; pos += GAP;
@ -148,7 +149,7 @@ public class WndHero extends WndTabbed {
add( txt ); add( txt );
txt = PixelScene.renderText( value, 8 ); txt = PixelScene.renderText( value, 8 );
txt.x = WIDTH * 0.65f; txt.x = WIDTH * 0.6f;
txt.y = pos; txt.y = pos;
PixelScene.align(txt); PixelScene.align(txt);
add( txt ); add( txt );