Trigger movement

Another type of movement that we can implement on our enemies or platforms is the trigger movement. This is also a basic way to create movement, where the enemy or platform is moving in one direction until it collides against something and then returns back. We can see this on multiple games, especially 2D platforms.

As we can see in the preceding image, the green circle represents the enemy and the red arrow represents the trigger distance. When the trigger touches the wall, the enemy turns around and moves in the opposite direction.

When should we use this method instead of the animation one? Using the animation movement, ...

Get Learning C# 7 By Developing Games with Unity 2017 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.