top of page

Day 20: Animating enemies, adding health and stamina bars and more...

What my plan is:

I want to work on animating a walking animation for the enemy, so it feels more realistic. Along with that, I also want to start adding in a interactive UI for the player, so that features such as health can be implemented.


What I accomplished:


I got a lot accomplished today. I started off by animating the enemy to have a walking animation, which was simply done by using an animator controller and importing the animation. The next important part of any combat game is the player healthbar. And so with the help of UI images and sliders, I managed to make a healthbar that reduced in health every time I pressed the "Z" key. Once that was done, I realized that my character could no sprint forever. Adding a stamina bar was slightly harder than the healthbar, although the basic premise remained the same. I used a slider to create a bar that would regenerate everytime left shift and "W" were not held together at the same time. This meant when the player was sprinting, the bar would go down, and when he was walking or idle, it would regenerate. I did this using simple code, which I then attached to my parent gameobject. Finally, I decided to add in footstep noises for the enemy. I thought this would be rather easy, except I soon realized that no matter where in the world I went, the footsteps were still as loud as when I was right next to the enemy. To correct this, I delved into the concept of the doppler effect. By changing a quick setting in the audio source, I managed to make it so that the audio would be louder closer and softer further away. _______________________________________________________________________________________________________


What is a slider?

In Unity, the Slider is a UI component that allows users to select a value within a specified range by dragging a handle along a track. By default, this value is a float number.


What is the doppler effect?

Doppler Effect refers to the change in wave frequency during the relative motion between a wave source and its observer.

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page