Azymoove Help

Your first battle

From your first robot to your first win, step by step.

Your first battle

1. Sign in and open My robot

Sign in and open My robot. Each account has one online robot. It starts with ready-made code that moves, turns the radar and shoots when it sees someone:

// Locks the radar on the enemy, aims by turning the body and strafes to dodge.
class Tracker extends Robot {
  // The body decides how the robot moves (see Documentation → Bodies and parts):
  // legs strafe, wheels race, treads endure, spiders grip the edge.

  // Parts: weapon, armor, head and torso. Budget: 12 points.

  constructor() {
    super({body: "forca", parts: {"weapon": "railgun", "head": "pesquisador.head"}});
    this.side = 1;
  }

  /** @param {State} state */
  run() {
    while (true) {
      const state = this.scan();
      const me = state.me;
      if (me.charging || me.energy < 20) { this.recharge(); continue; }
      const target = state.scanned[0];

      // Get away from the lava before anything else.
      if (me.distanceToEdge < 8) {
        this.turn(me.centerBearing);
        this.move(Math.abs(me.centerBearing) < 0.4 ? 5 : 0);
        continue;
      }

      if (target) {
        this.turnRadar(target.radarBearing * 2);
        // The gun is on the arm: aiming means turning the body.
        this.turn(target.bearing);
        if (Math.abs(target.bearing) < 0.05 && me.gunHeat === 0) {
          this.fire(target.distance < 15 ? 3 : 1.5);
        }
        // Strafes without losing the aim; switches sides when hit.
        if (state.events.some((e) => e.type === "hitByBullet")) this.side = -this.side;
        this.strafe(this.side * 4);
        if (target.distance < 4.8) this.punch();
      } else {
        this.turnRadar(1);
        this.turn(0.05);
        this.move(3);
      }
    }
  }
}

2. Test before fighting

In the editor, use Validate code and then Test: the robot runs in a training arena, and you see whether it moves, aims and shoots as you expected. If something fails, the error message tells you the line and the reason.

3. Save

Save code creates a new version of the robot (v1, v2…). Battles use the saved version, never the editor’s draft.

4. Join a battle

In New battle, choose:

  • With other players: you create a room and pick the participant limit, the map and the arena. The battle starts by itself when the room is full.
  • Against the computer: it starts right away, against one of 5 training robots picked at random. It’s worth up to 2 ranking points.

You can also join another player’s open room from the home page.

5. Watch and improve

When the battle ends, open the replay. See where your robot went wrong: did it stand still with no energy? Fall off the arena? Miss its shots? Change the code, save a new version and try again. The Tutor can analyse the battle and suggest what to change.