“Hey, you! Let’s battle!” Adding a Line of Sight mechanic to your NPCs

13

Index

Attached Files

The following files have been attached to this tutorial:

.c3p

npc-los-example.c3p

Download now 255.98 KB

Stats

5,088 visits, 8,713 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 15 Oct, 2019.

Introduction

.C3P

npc-los-example.c3p

Download now 255.98 KB

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!

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!