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!

Step 1

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

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

})

Step 2

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

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

Step 3

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

Step 4

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)
})

Step 5

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

Step 6

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

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

Step 7

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

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

Step 8

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