MakeCode Detect Direction
I have wished that the agent could have a command to set the direction of the robot (like the builder can), so automation of tasks would be easier to manage. Today I found a workaround.
Scenario: You want the agent to perform a task starting from the same location every time, but when you teleport the agent to the location the agent it is not directed in the right direction to start. So you have to turn it before you can start.
Solution: Put a block on one of the sides of the starting point. Then use an IF statement to detect where the block is, and then turn automagically into the right direction to get started. In the example attached, the block is in front.
Scenario: You want the agent to perform a task starting from the same location every time, but when you teleport the agent to the location the agent it is not directed in the right direction to start. So you have to turn it before you can start.
Solution: Put a block on one of the sides of the starting point. Then use an IF statement to detect where the block is, and then turn automagically into the right direction to get started. In the example attached, the block is in front.
0
Please sign in to leave a comment.
Comments
0 comments