The Problem:
It was decided that we needed to add an item drop when enemies die. After some discussion we had determined that the healers should drop health potions and that the mage enemies should drop mana potions. At face value, this should be an easy enough function to implement.
Essentially, I went back to both the healer and the mage enemy and updated their death functions. Once dead, they would call the parent function and then proceed to spawn the corresponding potion. This in fact worked except for the fact the player could not pick up the potion. I went back and review the code and tried a handful of things such as saving the potion as a variable and setting the collider back on, etc. Try as I might, I couldn’t figure out why the dropped potions couldn’t be picked up.
<Reference Pic of the implementation>
The Solution:
After some time, I reached out to the team to look at my code and to double check the logic. As it turns out the logic was sound except for one little detail. Unknown to me, but a new line of potions was created. These were in fact the potions I needed to call. The potions I was currently calling were no longer being used, hence when I tried to pick them up, it didn’t work. I made the switch and now the system works without issue.
<Reference pic before the enemy was killed>
<Reference pic after the enemy was killed>
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.