Tutorial on how to make random movement for enemies in your game

I figured out how to make random enemy movement! Today I’ll show YOU how to do it.
First, give your enemy top-down movement behavior. Then you add an object variable to the enemy called Move. Go to events then add an event thatchecks the variable Move. If “Move” is = 0, simulate pressing left for enemy. If Move is = 1, simulate pressing right for enemy. Then do the same thing twice but instead for the first one if it’s 2 then move up then if 3 then down. Once that’s done, make an event that is always active so there’s no condition. Then the action of that event is change the value of object variable Move to Random(3). Done! Simple, right? Optionally, you can add your player and add top-down movement to it to. Then make an event where if the player is in collision with the enemy, subtract 1 from a variable of the player you can make called Health. Here’s how I used it in my game:pictut

4 Likes