Introduction
In this tutorial, we’re going to be looking at adding a Line of Sight-based system where an NPC can notice the player and trigger an action. It will function in a similar way to when a trainer challenges you to a battle in Pokemon games. Hence why this tutorial is titled ‘Hey, you! Let’s battle!’
This tutorial follows on from the NPC tutorial and will build upon the mechanics created in that project. It uses the directional instance variables used in the first project to cast rays using the Line of Sight behavior which triggers the desired mechanic. In this case, it triggers a simple layout change, with a button to return to the previous layout. However, this also allows the demonstration of the persist behavior – all the NPCs should be as they were when you left the layout, to begin with!
So without further ado, let’s begin setting up the project!