Maths Question - Mudokon Health

Hello

I am currently working on a platform game called Twice Ze Flavor and I need some help.

Basically, in the game the Mudokons get different emotions. If a Mudokon becomes depressed, his voice will start raising in pitch every time he slaps himself. Me and Legna have figured out in the original game that the Mudokon slaps himself 13 times.

So what would be the best way to program it’s HP?

If Abe and the Mudokon were to get 100 health each, taking away -8 each time would work - but the last slap would be at -4, death would be at 0.

Any suggestions on HP values would be great!

The slap could influence some other variable instead of or in addition to health. Like call the variable Annoyed or Aggravated, and then have that variable influence the sound pitch.

Also, you might not need to think of this as a procedural problem to solve. If there is a finite number of things to say during self slapping, you could simply pre-record each one and pre-apply audio effects to the various audio files instead of manipulating pitch at runtime.

On the death handler, you could use a co-routine to manage the actual death of the NPC after the NPC has finished playing its final audio file. You could even have a state machine with Alive, Dead, as Dying as possible states. In the Dying state, the NPC would play its final audio file and then go into the Dead state. The NPC would ignore everything else during the Dying state.

1 Like