devilish666@lemmy.world to Programmer Humor@lemmy.ml · 6 months agoAaargh....my eyes......my eyes......lemmy.worldimagemessage-square16fedilinkarrow-up17arrow-down10
arrow-up17arrow-down1imageAaargh....my eyes......my eyes......lemmy.worlddevilish666@lemmy.world to Programmer Humor@lemmy.ml · 6 months agomessage-square16fedilink
minus-squarecookie_sabotage@sh.itjust.workslinkfedilinkEnglisharrow-up3·6 months agopublic class GameManager : MonoBehaviour { public bool EnableHighContrast; public bool PlayerWon; public float PlayerUnitsMoved; public int PlayerDeathCount; public float PlayerHealth; public void PlayerTakeDamage(float damage) { PlayerHealth -= damage; if (PlayerHealth < 0) { PlayerDieAndRespawn(); } } public void PlayerDieAndRespawn() { return; } } I couldn’t contain myself.
minus-squareWise@feddit.uklinkfedilinkEnglisharrow-up0·6 months agoShould it be PlayerHealth <= 0 ? Otherwise the player could have 0 health and not die? I’m sleep deprived so forgive me if I’m wrong
minus-squarevithigar@lemmy.calinkfedilinkarrow-up1·edit-26 months agoYou are correct about it allowing you to have zero health and not die, but whether or not that’s the correct behavior will depend on the game. Off the top of my head I know that Street Fighter, some versions at least, let you cling to life at zero.
minus-squareWise@feddit.uklinkfedilinkEnglisharrow-up5·6 months agoCounting this meme as my first FOSS contribution
public class GameManager : MonoBehaviour { public bool EnableHighContrast; public bool PlayerWon; public float PlayerUnitsMoved; public int PlayerDeathCount; public float PlayerHealth; public void PlayerTakeDamage(float damage) { PlayerHealth -= damage; if (PlayerHealth < 0) { PlayerDieAndRespawn(); } } public void PlayerDieAndRespawn() { return; } }
I couldn’t contain myself.
Should it be
?
Otherwise the player could have 0 health and not die? I’m sleep deprived so forgive me if I’m wrong
You are correct about it allowing you to have zero health and not die, but whether or not that’s the correct behavior will depend on the game. Off the top of my head I know that Street Fighter, some versions at least, let you cling to life at zero.
You are correct.
Counting this meme as my first FOSS contribution