From 75feed842c0b0205c09b005ae2b120708387e103 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Sun, 21 Jul 2019 19:27:04 -0700 Subject: [PATCH] Added heart blinking animation. --- .../SeasideScramble/Graphics/UI/Heart.png | Bin 126 -> 160 bytes .../SSCMenus/HUD/CharacterHUD.cs | 33 ++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/Heart.png b/GeneralMods/Revitalize/Content/Minigames/SeasideScramble/Graphics/UI/Heart.png index 6ba6c1f03e8e17381f9aebee49180c44ae69f892..d560e3b0c0fb68985dd5e6fdb2645039c5e7ceac 100644 GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^`!3HEhORwJpq|!ZI9780gCMN&^N20)Q`9lid zTfF&U*MeCSZu%IUJDdDlBI->1 z!J97@_E)M!3HGx`C7_=l&hzUV+hC0CMTTmAlDyxF73lk`9OOuXTO=2?@Icr}v7 WsXA}vTc2j2fefCmelF{r5}E+R_$deg diff --git a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/HUD/CharacterHUD.cs b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/HUD/CharacterHUD.cs index df923b81..0f661cd1 100644 --- a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/HUD/CharacterHUD.cs +++ b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCMenus/HUD/CharacterHUD.cs @@ -20,6 +20,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD public AnimatedSprite heart; public TexturedString playerHealth; + public bool showFullHeart; public int remainingHealthLerpFrames; public int framesToUpdate = 5; @@ -29,6 +30,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD public AnimatedSprite clock; public TexturedString reloadTime; + + public SSCPlayer Player { get @@ -48,10 +51,19 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD this.playerID = Player; 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>() { + + {"Full",new List(){ + new Animation(0,0,7,6) + }}, + {"Empty",new List(){ + 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.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.playerAmmo = SeasideScramble.self.gameFont.ParseString("100", new Vector2(100, this.yPositionOnScreen + 50), Color.White, true, 2f); @@ -75,9 +87,17 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD } else { - this.playerAmmo.setText(this.Player.gun.remainingAmmo.ToString().PadLeft(3,'0'), SeasideScramble.self.gameFont, Color.White); + this.playerAmmo.setText(this.Player.gun.remainingAmmo.ToString().PadLeft(3, '0'), SeasideScramble.self.gameFont, Color.White); } - 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"); } } @@ -91,6 +111,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD this.remainingHealthLerpFrames = this.framesToUpdate; if (Convert.ToInt32(this.playerHealth.getText()) != this.Player.currentHealth) { + this.showFullHeart = !this.showFullHeart; int health = Convert.ToInt32(this.playerHealth.getText()); health = health - 1; string healthStr = health.ToString(); @@ -116,7 +137,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD this.background.draw(b, this.background.position, new Vector2(8f, 4f), 0f); this.playerHealth.draw(b, new Rectangle(0, 0, 16, 16), 0f); this.heart.draw(b, 8f, 0f); - if (this.Player.gun.isReloading==false) + if (this.Player.gun.isReloading == false) { this.gun.draw(b, 4f, 0f); this.playerAmmo.draw(b, new Rectangle(0, 0, 16, 16), 0f); @@ -137,7 +158,7 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame.SSCMenus.HUD this.showHUD = true; this.gun.animation = this.Player.gun.sprite.animation; - //SeasideScramble.self.getPlayer(this.playerID).takeDamage(100); + SeasideScramble.self.getPlayer(this.playerID).takeDamage(100); } ///