During this week I worked primarily on camera rotation, a camera management system, and player attacking. Most of it went smoothly and I was able to complete most stuff within a reasonable time period, except reworking the player attack. Before, the player’s attack was based on a simple bool that was set when player pushed a button, and reset and when the player released the button. However, this was method was only meant for testing, and this week I planned to make the attack based off of time. To begin this reworking, I added a time variable to the weapon component which would be manipulated when the attack button is pressed. This simple change and implementation wasn’t time-consuming, but implementing a combo attack to trigger if the player made three consecutive attacks within a short span of time took more time than I planned.
Moving on, my first step to tackle this problem was to add a counter to the weapon component to be incremented when the player attacked and reset if the player stops attacking or if the combo is triggered. Next, I rewrote a portion of the code to make the counter be incremented whenever the attack button is pressed, followed by a check to increment time variable if the counter is not zero. Then, I wrote several checks based off of the value checking: if time is equal zero do nothing, if time is less than 0.175 seconds attack, or else reset counter. This enabled the counter to incremented and reset as I desired, making it easier to make the combo work. Finally, I placed another check inside the attacking statement that would check the value if the value of the counter was three or greater which in turn would trigger the combo. To test this, I had the program print the value of the counter to the log every time the attack button was pressed, and print out “Combo” to the log if the combo was triggered. After some testing and fine tuning, the combo worked as intended.
– Logan Acree