Attacking Functionality


Hello there!

Welcome back to the Freedom devlog, last time we covered the basics of the environment that the player is going to play in. This time I will cover the players' and enemies' attacking functions. I decided to go with adding the players' attack first, this was done by creating a bullet prefab which would then be spawned into the scene when the player presses the fire button

To get the shooting function to work all it took was defining where the shot would come from by creating a "shooting point" and adding it to the player object, then the bullet would be given a direction in which it was to travel and the speed of which it would do so would be determined by a "Speed" variable which can be changed at any time.

After carrying out this process to give the player an attack option, it was now time to give an attack function to the enemies. This function would work more or less the exact same as it would for the player but since there would not be a user controlling when the enemy fires, because of this it was essential to add a function that made it so that the enemy shoots by itself at a predetermined firing rate.

And with that we are now set with both player and enemy attacks. Thank you for reading along and feel free to follow along with further updates and developments. See you next time!

Get Freedom

Leave a comment

Log in with itch.io to leave a comment.