Dev Log 7

In the previous week when designing my desert level I made a long platform with the intention of adding in an obstacle. After consideration I have decided to make this into a swinging pendulum trap that you will have to time correctly in order to get past it. However before I made this I needed to add in a simple health system. 

When making my health system I decided to keep it simple as there is only going to be two options of alive or dead. The way I made my health system I created a new float variable which I set to 100. I then used the event any damage node to subtract the damage the character will be dealt and when it is equal or below 0 the actor will call the custom death event I made which will destroy the actor. I found this process easy as this is something I have done many times before and with the repetition it has allowed me to remember the key nodes you need to use and how they make the final outcome. 


Once I had my health system sorted this then allowed me to move onto coding the pendulum. I used sketch fab so that I could source an asset which would be used for the trap. I decided on using a low poly blade that will be swinging off a frame which I will later add into the game. I crated a new actor blueprint which I added a static mesh to and chose my blade asset and added in a box collision around the section I wanted the player to take damage. With the box collider selected I created an on component event which then allowed me to link the damage player code so that when the player touches that part the player will take damage. 

The final step to this trap was getting the asset to spin, for this I created a new timeline and made it a float. I then used a set relative rotation node so I could make sure that the rotation was on the correct axis using a lerp node to choose how far and how little the asset can rotate. However, when I test ran the game the pendulum was rotating with the pivot point in the middle which is not where it is supposed to be. To fix this I added in a cylinder component and made the pendulum a child of it, this then allowed me to change where the object is being rotated from so when I next test ran it it worked.
This was not complete as the pendulum would only swing to the point set and then stop in order to fix this I needed to add in a node coming from reverse so that when it swung to one point it would then reverse and swing the opposite way and continue in a loop. However, once I added this and test ran the game the pendulum was no longer swinging at all. To fix this I looked into the code I had just added and realised that the true and false were plugged in the wrong way around which is what made the pendulum no longer swing. I reversed these and test ran the game and everything worked as intended.
Now that I have the player health set up along with the swinging pendulums working as intended, I will be looking to add in checkpoints so that the player doesn't have to start all over again every time they fail a challenge.

The progress I have made this week was very important into completing and progressing in my project as this added in the element of difficulty into the game. During the production of the pendulum it allowed me to use the timeline node which I have only used a few times in the past. I feel that after this I now have a deeper understanding of the timeline node works and how you can modify it to meet your needs.

Comments

Popular Posts