Moving Enemies - Following

 moving enemies image

How to implement this Pattern in MakeCode

Step by Step instructions

This game mechanic works well when you have enough time to run away from these enemies or somehow get rid of them by shooting or jumping on them. This tutorial assumes you have already added a static enemy pattern.

As with static enemies, we need to edit out tilemap and add a new colour of tile to our tilemap and place one in a location. In this case be sure to change your design to add some black blocks.

add another tile

Now follow the same kind of pattern for creating a static enemy but change the final blocks. I’ve chosen a small meteorite from the Gallery here. Having a small follower looks good.

Add a set to follow block from our Sprite section a set followingEnemy to follow mySprite with speed 40. Set this been to follow mySprite which is your player sprite.

add another tile

In the block above I’ve changed the speed of the bee to be slower at 40 than the default 100 as in this example the player just has to run away from the meteorite.

Test your Changes and Next Steps

Test your game to check that your changes have the desired behaviour and that there are no side effects.

To check that you are making the most of this pattern you can ask yourself the following questions:

This Game Pattern is one of many allowing you to make improvements to your platform game and to learn coding and wider computing concepts. Find more on the Game Pattern page.

This pattern may make your game much more challenging. To balance it out a potential next step may be to add the jump on enemies pattern to your game if you haven’t already.