Adding Enemies to Your Game: Microsoft MakeCode Arcade

Kiki Prottsman
Kiki’s Corner
Published in
3 min readOct 2, 2023

So you’ve tried some Microsoft MakeCode Arcade tutorials and now you’re looking to push the envelope further. What’s next? How about adding some complexity and excitement to your games by incorporating enemies? It’s a surefire way to elevate a challenge and make your game more engaging.

The Purpose of Adding Enemies

Enemies serve a purpose beyond just challenging the player. They can create tension, set the pace, and drive the narrative of your game. Think of them as the antagonists in your interactive story, each serving a unique role in enhancing the player’s experience. The real question is, how do you go about adding them?

Types of Enemies

Let’s start by categorizing the types of enemies you can add. Simple enemies might stand still while shooting projectiles. More complex enemies could follow a predetermined path or mindlessly follow the player as they navigate the game. You may even be able to create opponents that appear to make decisions as the game goes on. The key here is to start simple, then gradually add layers of complexity.

Basic Implementation

Adding an enemy in MakeCode Arcade is fairly straightforward. You can create a sprite and assign it behaviors, much like you would for the main character. You could set your enemy sprite to move horizontally across the screen or bounce back and forth between two points. These are the basics and a great starting point for any game designer.

The key to making them “dangerous” is to set up an overlap event that ends the game, removes lives, or reduces hit points.

This set of blocks moves the enemy away once it hits the player, then removes a life and starts a “pain” animation

For an extra challenge, you can also assign an enemy to “follow” your main sprite, and add code that has it turn around or jump obstacles.

The blocks on the left set up every enemy as soon as it’s created. The blocks on the right cause the enemy to try to jump when it hits a wall. (The `make sprite hurdle side wall` block is from a special extension.)

Testing is Crucial

As with any feature, especially one as impactful as adding enemies, testing is crucial. Play the game multiple times, tweak the mechanics, and make sure the enemies provide a balanced level of challenge.

By integrating enemies into your game, you not only increase the game’s complexity but also its appeal. Whether it’s a basic foe that moves in a straight line or a complex villain that adapts to the player’s actions, enemies bring your game to life in a way that static obstacles and puzzles can’t. So go ahead, add a foe or two, and watch your Microsoft MakeCode Arcade game transform into a dynamic, challenging, and utterly engaging experience.

--

--

Kiki Prottsman
Kiki’s Corner

Kiki is an author, educator, and the Director of Education for Microsoft MakeCode