Posted April 22, 2023 by Adrian Rosario
##gamedev ##indiegame
Hello, fellow game enthusiasts! It's your friendly neighborhood coder, back again to entertain you with the latest adventures in our game's development. Today, I'll be sharing the epic journey of creating the UI, inventory system, and our AI enemy. Buckle up, and let's get started!
As someone who's not an expert in UI coding, this task was quite a challenge. However, fueled by determination (and a healthy dose of caffeine), I bravely ventured into the abyss.
Our first task was to create a EnemyHealth
script that handles our enemies' health and inevitable demise. Piece of cake, right? To spice things up, we also added a BulletDamage
script that applies damage to enemies upon collision. Finally, our enemies can meet their tragic (and well-deserved) end!
Next on the agenda: the loot system. After implementing a basic loot system where enemies drop items upon death, we added a LootTableItem scriptable object and a loot table to the EnemyHealth script. The DropLoot() method in the EnemyHealth script handles item drop chances and instantiation. It was a bit of a rollercoaster, but the satisfaction of seeing those precious items drop was worth it!
We thought, why not make our enemies' deaths even more extravagant? So, we added particle effects for enemy death and item spawn. Alas, our efforts were thwarted as the enemy GameObject vanished too quickly to savor the visual feast. But fear not, for we shall revisit and perfect these particle effects once we find a solution to make our enemies linger just a bit longer.
In an effort to add some pizzazz, we implemented a flashing effect for both the enemy and the player when they take damage. The FlashEffect() Coroutine, found in both the EnemyHealth and playerMovements scripts, temporarily changes the sprite color, creating an exciting flashing effect. Now, there's no hiding when you're hit!
The pièce de résistance: the player's health, damage, and UI. This challenge was no walk in the park, but with sheer determination and a bit of hair-pulling, we emerged victorious. We even added the flashy effect to the player's TakeDamage()
method, providing a visual cue when the player takes damage. No more blissful ignorance!
Due to some unforeseen circumstances, our artist's assets were unavailable. So, we turned to our trusty AI companion, Midjourney, to generate the enemy. While we plan to replace them in the future, I must say, that AI was a fantastic source of inspiration and world-building assistance. It seems artificial intelligence can be quite the creative sidekick! Here is a quick view of what we got :)
In conclusion, our journey through UI, inventory systems, and enemy creation was nothing short of exhilarating (and occasionally hair-raising). Despite the challenges, I found a newfound appreciation for UI coding (shh, don't tell the other coders). And who knows, maybe we'll continue to find hidden gems in our AI-generated enemies.
Stay tuned for more updates on our game's development! Until next time, happy coding, and game on!