RPG Hack Slash Game: Early Progress the Player Controls and Enemy Movement

The next step is create a couple of scripts that controls the players and enemies movements. Also the attack script is implemented into both the players and enemy game object. 

To do this firstly a third person controller and script is attached to the Player game object. This will allow the object (which is the player game object in this case) to be control using the keyboard controls. Below is an example of the script.

Screen Shot 2017-01-17 at 17.09.02
Figure 1: Third person Controller Script


The next step is to implement a way for the enemy to move towards the player. This is achieved by using a function that allows the enemy to see the player and then rotate and move towards the player. When the player moves away the enemy will continue to follow them. Below is the script i used for the enemy chase.

Screen Shot 2017-01-17 at 17.10.03
Figure 2: Enemy Attack Script: Chasing the Player

Once the script is created the next step is to implement the player attack script. This will allow the player to able to attack the enemy. Down the line it will be developed into a more complex structure such as selecting which enemies to attack and maybe potential interacting with objects. Below is the script.

Screen Shot 2017-01-17 at 17.09.35
Figure 3: Player Attack Script.

Leave a Reply

Your email address will not be published.