Thursday, October 8, 2015

Homework 5

Since our game will be dealing with a lot of AI moving about that the player can interact with, I've created an AI character with a hit-box that follows a set path on a level, and if the player encounters the enemy, the player is then transported to a battle screen.



As one can see in the picture above, the AI character is simply a sphere at this point, and it has attached to it a hit-box. On event collision, a new level opens and the player is transported there.


As for the pathing that the AI takes, that's a little more complicated. On begin play, reference the path algorithm pawn, and cast it to the AI described above. Now that we have our pawn and pathing, set the AI path to a node location and move the AI there. This moves the character to its first desired location. The blueprint for this can be seen in the top portion of the image below.


In order to move the AI to the next desired location, we need an event tick that is attached to an if statement that checks if the AI pawn has reached it's location, and has stopped. To check this we need to get the move status of our actor and compare it to a boolean we created that is set to true. We use a != boolean comparison to return true or false back into the if statement for the event tick. If the pawn has stopped, we set the current node that the AI is at, and then we reference the next node that is attached to the current node. The current node becomes the next node and so on and so forth. Last;y, we get the AI to move to the next node, and this repeats over and over, making the AI move about the map. All of the code for this section can be seen in the lower half of the image above.

No comments:

Post a Comment