top of page

Impulse: Impulse Meter and Basic Attack

To finish off my UI, I have added another fill-bar element to track the active character's Impulse. As this is the core, unique mechanic of the game, I have made this bar stand out from the health and energy bars by making it wide and vertical rather than thin and horizontal. As the Impulse mechanic will differ between characters, it effectively acts as an additional passive ability and so I have placed the impulse meter next to the abilities in the UI. Due to the complexity and importance of each character's Impulse mechanic, I have given tooltip functionality to the Impulse meter, giving the player an explanation of the active character's Impulse.


The more noteworthy addition today was the implementation of a basic attack ability. I created a variant of the base character prefab which I will be building into my first player character, Lucius the vampire. As per my game design document, I named Lucius' first ability "Bloody Slash" and used this as my basic attack. Previously, as movement was the only ability available, only areas of ground could be targeted by the player. To allow for an attack ability, I added code to the manager script which detects if the mouse is pointed at a character and then sets them as the target for any character targeting abilities.


Character targeting in the update function:

Now that characters could be targeted, I added the "Bloody Slash" code to the "perform action" function. This checks if the target is within range of the acting character and is their enemy. It then checks that the acting character has enough energy to perform the attack. If these conditions are met, energy is spent and damage is dealt to the target.

Once damage was being dealt to the enemy, that needed to be displayed in the UI. So I added an "update UI" and a "die" function to the base character script to change the character's overhead UI when attacked.

Since I was now starting to put together my first character, I thought it was a good time to make some visual additions. I removed the placeholder mesh from Lucius and attached a prefab character model from the Unity store as a child object to represent him in game. The character currently just uses an idle animation and doesn't look especially like a vampire, but it will do for now. When doing this, I noticed that that character was a bit hard to see due to the dark setting. To combat this, I added a dim spot light above the base character prefab.


Here's a video of everything working:


Comments


bottom of page