Agent Moves

Introduction

Get your agent to move. In this tutorial you will make some chat commands to have your agent move and turn.

Make your agent dance!

Chat command

Insert an ||player:on chat command|| and rename it to “tp” (short for teleport).

player.onChat("tp", function () {

})

Teleport agent

Put a ||agent:agent teleport to player|| inside the ||player:on chat command||.

player.onChat("tp", function () {
    agent.teleportToPlayer()
})

Try chat command

Go to Minecraft, press t to open the chat and enter tp.

Move agent

Put in another ||player:on chat command|| and rename it “fd”. Place a ||agent:agent move|| to move the Agent forward by 5 blocks.

player.onChat("fd", function () {
    agent.move(FORWARD, 5)
})

Try chat command again

Go to Minecraft and enter fd in the chat. Will the Agent move?

Turn left

Put in a new lt chat command to turn the Agent left using ||agent:agent turn||.

player.onChat("lt", function () {
    agent.turn(LEFT_TURN)
})

Turn right

Add a new rt chat command to turn the Agent right.

player.onChat("rt", function () {
    agent.turn(RIGHT_TURN)
})

Try out each move!

Go to Minecraft and enter commands tp, rt, lt or fd in the chat to control your Agent!