Move Me: Better Ways to Move the Player in MakeCode for Minecraft

Move Me is a handy gadget  that I use when debugging my code. When on the hunt for programming bugs, a clean world area is needed every time the program is tested. To date, I have thought of five ways in which this can be done:

  1. The most obvious is to use the keyboard or buttons to fly the player far away from the trashed area to a clean area. My fingers get tired, I get lost, and flying is so boring.
  2. A better way than flying is using “/tp @s ~200 ~0 ~0” in the command line to move relative to the player 200 east, 0 up, and 0 south — or however far and in which ever direction you like. Typing this makes me crazy because I must look at the keyboard for the symbols I rarely use. And, of course, I make mistakes. When using this method, I type the commands I use often into a text document, which I keep open,  and copy/paste to the command line. Efficient, but I don’t like having still yet another open file, and going back and forth to it is distracting.
  3. Make a program that with one easy-to-remember chat command moves the player to a clean positon. Move Me is such a program and  is described in this post.
  4. Make a program that restores the used world area to it’s pristine condition. Flat Fixer is described in another post.
  5. Create a new world. Way too time consuming, but I use it when I want a really, really clean world.

When developing a new program, especially when leaning a new language as I have been doing with MakeCode, I usually try the program many, many, many times until it works correctly and I have settled on the programs features. Move Me is my favorite way to get to a clean world area.

Move Me

With just one chat command using Move Me, the player is moved from the mess on the left  to the pristine field  on the right so far away from the mess that it can’t be seen.

Move Me CodeMove Me has two parameters (arguments): E and S, which specify the distance to move east and south, respectively. Of course, negative E is west and negative S is north, so the program allows movement in all four directions. If both parameters are 0, there would be no movement. This case is used to trigger the default values of 200 E and 0  S. If a parameter is omitted, its value is 0. Typing “run” in the command line with no values for E and S is equivalent to E=0 and S=0, which  triggers the defaults, and is the same as typing “run 200 0.”

Notice that the teleport block specifies a relative positon. It causes the player to be moved E blocks east and S blocks south of where the player started. The up coordinate moves 0 blocks, meaning the player stays in the same vertical position.

This program has one big advantage over manually flying to a new location. In manual flying it is easy to accidently return to an old used location. Using Move Me and moving the same direction every time, the player never accidently returns to an old trashed area. In most cases, I just use “run” with no parameters. The default always move east, so does not return to any prior position.

Move Me takes some of the pain out of debugging.

Get the Code

This code is sometimes susceptible to the Chat Command arguments bug described the our prior post.

The code is shared at  where it can be downloaded an run in MakeCode for Minecraft.