Updating Doggo Daycare's Potion System
First Update following the Jam
Following the week long Game Jam that took part, I have been updating the awful code that was wrote in a hurry during. The first piece of code I wanted to change up was the Potion system.
Two Potions currently exist in Doggo Daycare: Healing and Death. Both scripts for these potions contain all the functionality of the pickup text, pickup mechanic and the potion effect being carried out. This was due to the code being copy and pasted from one to the other when creating the potion scripts. To solve this repetition I used our good friend Inheritance.
All of the pickup functionality was added into a new script which could then be inherited from by both the Heal potion and the Death potion.
The Healing potion script shown now only takes up a small number of lines in comparison to the 47 lines it originally used.
This change does not effect the gameplay in any way. However, allows for new potions to be created much quicker as all we need to do is override the OnActivate() method and fill it with the functionality. Along with potions, this also allows for other pickups in the game, such as new weapons, although a weapon equip system would need to be created first to allow for this.
Leave a comment
Log in with itch.io to leave a comment.