Hierarchy

  • Robot

Constructors

  • Returns Robot

Properties

listener: Function
player: Player
robotIdList: any = []
serverConfig: {
    apiKey: any;
    eventId: any;
    spaceId: any;
} = ...

Type declaration

  • apiKey: any
  • eventId: any
  • spaceId: any

Methods

  • Add robot from data list

    Example

    If you wanna add a robot with id 123.

    app.scene.addRobot({"123": {name: "robot", "birth": "specialArea1", "avatar": 1}})
    

    Throws

    Error message

    Parameters

    Returns Promise<RobotData[]>

    If it is successfully sent to the server, it will return true. Otherwise it will return an error message

  • Move a robot to the specified coordinates

    Example

    If you wanna remove robots with id '123' and id '456'.

    app.scene.exitRobot(['123', '456'])
    

    Throws

    Error message

    Parameters

    • idList: string[]

      robots id list

    Returns Promise<boolean>

    If it is successfully sent to the server, it will return true. Otherwise it will return an error message

  • Move a robot to the specified coordinates

    Example

    If you wanna move a robot to [2,3] and say "hello".

    app.scene.moveRobot('123', 2, 3, 'hello')
    

    Throws

    Error message

    Parameters

    • pid: string

      robot id

    • x: number

      x-coordinate

    • y: number

      y-coordinate

    • message: string

      words said after moving to position

    Returns Promise<boolean>

    If it is successfully sent to the server, it will return true. Otherwise it will return an error message

Events

  • Get a random coordinate point in the special area name

    Parameters

    • name: string

      the name of special area calculatedPosition()

    Returns {
        index: any;
        x: number;
        y: number;
    }

    • index: any
    • x: number
    • y: number
  • Get an avatar by index

    Parameters

    • avatar: number

      the index of avatar, options: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 20] getAvatar()

    Returns string

    avatar url

  • Randomly generate an avatar randomAvatar()

    Returns string

    avatar url

Generated using TypeDoc