Search
  • Nathan Tubb

My Project 13: Medical Items

Updated: Apr 30, 2021

When playing a game where you have to fight zombie and giant iron golems there comes a time where you might need to replenish some health to stay in the fight. To achieve this in the project I have added two healing items, bandages and Painkillers. Which you can see me using the video below..

The implementation of these items is an extension of the polymorphism script system used for all equipable items in the game. It allows for the combat system to establish what action to take depending on the type of item it has been given without needing extra code to specify what functions to run.

Bandages: Single use items that instantly heal the player for 10% of their health

Crafting: 4 twine

Lootable: True


Painkillers: Multi use items that heal the player for 30% of their health over time

Crafting: N/A

Lootable: True


To script I edited part of the auto-heal script from the screen damage pack that I purchased for the game (featured in the next post), to make sure that the system healed a total of 30% health I had to use a separate tracker to the player's current health change, as that could be affected by other factors, so instead I create a temporary integer that will be increased at the same rate as the player's health without being affected by anything else. Once the player has reached max health or the healed amount reaches 30% healing is finished.


Thanks for reading!





0 views0 comments

Recent Posts

See All