Doors and Portals in MakeCode Arcade: Unlocking New Dimensions in Game Design

Kiki Prottsman
Kiki’s Corner
Published in
3 min readJan 8, 2024

--

Have you ever tried making puzzle or mystery games in Microsoft MakeCode Arcade? Portals, locked doors, and secret passageways can be just the thing you need to add intrigue and magic. In this post, I’ll dive into the process of creating and utilizing doors and portals in MakeCode Arcade games.

Understanding the Basics

Before we start coding, it will be helpful to understand what doors and portals are in the context of video games. In essence, doors often serve as a transition between connected levels or scenes, whereas portals can instantly transport players to far away locations. Both can help create a multi-layered gaming experience.

Designing Doors and Portals

The first step is to create your door and portals. This means that you need to decide whether you’ll be relying on sprites with overlap events or tilemaps.

Whichever method you choose, you’ll need to find (or create) the image you want to use as your door or portal and add it to your game.

For doors, you might opt for a traditional wooden look, or something more fanciful, like a glowing energy gate. Portals, on the other hand, can be swirling vortexes or sci-fi-inspired teleportation pads. Adding animations is much more simple when using the sprite method, but it’s not impossible for tilemaps.

Also keep in mind that your doors and portals can be nearly any size in the land of sprites, whereas tiles are limited to squares of 16 pixels by 16 pixels.

Implementing Teleportation

Once your doors are ready, it’s time to breathe life into them with code. You’ll need to write a program that detects player interaction (like a button press) when they’re near the door or something that detects when the player and the door are overlapping. This interaction can trigger a level transition, or teleport the character to another spot within the same level.

For instance, you can use an on overlap block to detect when the player overlaps with the door, then change the player’s position with an X, Y shift using the position block:

Or you could have the player press the (A) button when they’re near the door and change the tilemap and background to appear to send them someplace new entirely.

Mix and match approaches depending on the mechanics that make the most sense for your game.

Solving Common Challenges

One challenge you might face is preventing the player from immediately re-entering a portal after teleportation, which can create a disorienting loop.

Here are a few solutions for that issue:

  • implement a short cooldown period for the portal’s activation using the pause block
  • design the game so that the player teleports to a spot away from any immediate portal re-entry
  • delete the portal once used so the player needs to find another one in order to get back

Conclusion

Doors and portals are more than game mechanics; they are narrative devices that can enhance your playing experience. In MakeCode Arcade, implementing these features is not only possible, it’s also a creative process that allows coders to explore new dimensions in game design.

By mastering these elements, you open a world of possibilities, making your games not just fun to play but also rich in exploration and adventure!

--

--

Kiki Prottsman
Kiki’s Corner

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