v0.8.0: added shielding to boss health bars
This commit is contained in:
parent
e24ee139ad
commit
b36db88c8c
Binary file not shown.
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 439 B |
|
@ -32,6 +32,9 @@ import com.watabou.noosa.ui.Component;
|
||||||
public class BossHealthBar extends Component {
|
public class BossHealthBar extends Component {
|
||||||
|
|
||||||
private Image bar;
|
private Image bar;
|
||||||
|
|
||||||
|
private Image rawShielding;
|
||||||
|
private Image shieldedHP;
|
||||||
private Image hp;
|
private Image hp;
|
||||||
|
|
||||||
private static Mob boss;
|
private static Mob boss;
|
||||||
|
@ -58,6 +61,13 @@ public class BossHealthBar extends Component {
|
||||||
width = bar.width;
|
width = bar.width;
|
||||||
height = bar.height;
|
height = bar.height;
|
||||||
|
|
||||||
|
rawShielding = new Image(asset, 15, 25, 47, 4);
|
||||||
|
rawShielding.alpha(0.5f);
|
||||||
|
add(rawShielding);
|
||||||
|
|
||||||
|
shieldedHP = new Image(asset, 15, 25, 47, 4);
|
||||||
|
add(shieldedHP);
|
||||||
|
|
||||||
hp = new Image(asset, 15, 19, 47, 4);
|
hp = new Image(asset, 15, 19, 47, 4);
|
||||||
add(hp);
|
add(hp);
|
||||||
|
|
||||||
|
@ -77,8 +87,8 @@ public class BossHealthBar extends Component {
|
||||||
bar.x = x;
|
bar.x = x;
|
||||||
bar.y = y;
|
bar.y = y;
|
||||||
|
|
||||||
hp.x = bar.x+15;
|
hp.x = shieldedHP.x = rawShielding.x = bar.x+15;
|
||||||
hp.y = bar.y+6;
|
hp.y = shieldedHP.y = rawShielding.y = bar.y+6;
|
||||||
|
|
||||||
skull.x = bar.x+5;
|
skull.x = bar.x+5;
|
||||||
skull.y = bar.y+5;
|
skull.y = bar.y+5;
|
||||||
|
@ -92,7 +102,15 @@ public class BossHealthBar extends Component {
|
||||||
boss = null;
|
boss = null;
|
||||||
visible = active = false;
|
visible = active = false;
|
||||||
} else {
|
} else {
|
||||||
hp.scale.x = (float)boss.HP/boss.HT;
|
|
||||||
|
float health = boss.HP;
|
||||||
|
float shield = boss.shielding();
|
||||||
|
float max = boss.HT;
|
||||||
|
|
||||||
|
hp.scale.x = Math.max( 0, (health-shield)/max);
|
||||||
|
shieldedHP.scale.x = health/max;
|
||||||
|
rawShielding.scale.x = shield/max;
|
||||||
|
|
||||||
if (hp.scale.x < 0.25f) bleed( true );
|
if (hp.scale.x < 0.25f) bleed( true );
|
||||||
|
|
||||||
if (bleeding != blood.on){
|
if (bleeding != blood.on){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user