attack

Commands the agent to attack in the given direction.

agent.attack(FORWARD);

Parameters

  • direction: the direction in which to attack, eg: FORWARD

Example

Makes the agent continuously attack around itself. Useful to defend against monsters!

loops.forever(() => {
    agent.attack(FORWARD);
    agent.attack(RIGHT);
    agent.attack(BACK);
    agent.attack(LEFT);
    loops.pause(1000);
});