This page looks best with JavaScript enabled

Code Reuse and a Simple Follow Script

 ·   ·  ☕ 1 min read

How simple can you make a script that gets enemies to follow a target or player? Turns out pretty simple.

In this video we’ll be looking at how we can reuse a lot of the already existing player movement controls we have developed for our interactive Mixer game to add a dead simple AI to the game. This will allow our enemies to identify and follow the player.

The script reuses the already created movement controls for the player as well as the input controller and simply needs a new input device. This input is our AI which will work by identifying a player and then moving the AI directly towards the enemy. It’s simple and won’t work in extended situations, but it gets us to the point of being able to actually test things now and that’s all we need.

This video also emphasizes the importance of object oriented design and how you can break components apart to make them easier to reuse in potentially entirely different ways. A key concept in any programming scenario.

Learn more about Mixer Interactive here: https://dev.mixer.com/reference/interactive/index.html which plays a larger part in the project we are working on in this video.

Discord: https://discord.gg/hU5Kq2u


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things and professional software engineer. Lets make something awesome together!