Added heart blinking animation.

This commit is contained in:
JoshuaNavarro 2019-07-21 19:27:04 -07:00
parent 0a2c1ee11b
commit 75feed842c
2 changed files with 27 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 160 B

View File

@ -20,6 +20,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
public AnimatedSprite heart; public AnimatedSprite heart;
public TexturedString playerHealth; public TexturedString playerHealth;
public bool showFullHeart;
public int remainingHealthLerpFrames; public int remainingHealthLerpFrames;
public int framesToUpdate = 5; public int framesToUpdate = 5;
@ -29,6 +30,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
public AnimatedSprite clock; public AnimatedSprite clock;
public TexturedString reloadTime; public TexturedString reloadTime;
public SSCPlayer Player public SSCPlayer Player
{ {
get get
@ -48,10 +51,19 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
this.playerID = Player; this.playerID = Player;
this.showHUD = false; this.showHUD = false;
this.heart = new AnimatedSprite("Heart", new Vector2(x + 32, y + 10), new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCUI", "Heart"), new Animation(0, 0, 7, 6)), Color.White); this.heart = new AnimatedSprite("Heart", new Vector2(x + 32, y + 10), new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("SSCUI", "Heart"), new Animation(0, 0, 7, 6), new Dictionary<string, List<Animation>>() {
{"Full",new List<Animation>(){
new Animation(0,0,7,6)
}},
{"Empty",new List<Animation>(){
new Animation(7,0,7,6)
}}
}, "Full"), Color.White);
this.heart.animation.playAnimation("Full");
this.playerHealth = SeasideScramble.self.gameFont.ParseString("100", new Vector2(100, this.yPositionOnScreen + 10), Color.White, true, 2f); this.playerHealth = SeasideScramble.self.gameFont.ParseString("100", new Vector2(100, this.yPositionOnScreen + 10), Color.White, true, 2f);
this.playerHealth.setPosition(new Vector2(this.xPositionOnScreen + 100, this.yPositionOnScreen + 10)); this.playerHealth.setPosition(new Vector2(this.xPositionOnScreen + 100, this.yPositionOnScreen + 10));
this.showFullHeart = true;
this.gun = new AnimatedSprite("Gun", new Vector2(x + 32, y + 50), new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White); this.gun = new AnimatedSprite("Gun", new Vector2(x + 32, y + 50), new AnimationManager(SeasideScramble.self.textureUtils.getExtendedTexture("Guns", "BasicGun"), new Animation(0, 0, 16, 16)), Color.White);
this.playerAmmo = SeasideScramble.self.gameFont.ParseString("100", new Vector2(100, this.yPositionOnScreen + 50), Color.White, true, 2f); this.playerAmmo = SeasideScramble.self.gameFont.ParseString("100", new Vector2(100, this.yPositionOnScreen + 50), Color.White, true, 2f);
@ -79,6 +91,14 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
} }
this.reloadTime.setText(((int)this.Player.gun.timeRemainingUntilReload).ToString().PadLeft(4, '0'), SeasideScramble.self.gameFont, Color.White); this.reloadTime.setText(((int)this.Player.gun.timeRemainingUntilReload).ToString().PadLeft(4, '0'), SeasideScramble.self.gameFont, Color.White);
} }
if (this.showFullHeart)
{
this.heart.animation.playAnimation("Full");
}
else
{
this.heart.animation.playAnimation("Empty");
}
} }
/// <summary> /// <summary>
@ -91,6 +111,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
this.remainingHealthLerpFrames = this.framesToUpdate; this.remainingHealthLerpFrames = this.framesToUpdate;
if (Convert.ToInt32(this.playerHealth.getText()) != this.Player.currentHealth) if (Convert.ToInt32(this.playerHealth.getText()) != this.Player.currentHealth)
{ {
this.showFullHeart = !this.showFullHeart;
int health = Convert.ToInt32(this.playerHealth.getText()); int health = Convert.ToInt32(this.playerHealth.getText());
health = health - 1; health = health - 1;
string healthStr = health.ToString(); string healthStr = health.ToString();
@ -137,7 +158,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD
this.showHUD = true; this.showHUD = true;
this.gun.animation = this.Player.gun.sprite.animation; this.gun.animation = this.Player.gun.sprite.animation;
//SeasideScramble.self.getPlayer(this.playerID).takeDamage(100); SeasideScramble.self.getPlayer(this.playerID).takeDamage(100);
} }
/// <summary> /// <summary>