melonjs
    Preparing search index...

    Class ObservableVector2d

    Represents a point in a 3D coordinate vector that can be observed for changes.

    Index

    Constructors

    • Creates a new ObservableVector3d instance.

      Parameters

      • x: number = 0

        The x-coordinate of the vector. Default is 0.

      • y: number = 0

        The y-coordinate of the vector. Default is 0.

      • Optionalcallback: () => void

        The callback function to be called when the point changes. Default is undefined.

      Returns ObservableVector2d

    Accessors

    Methods

    • Checks if this vector is equal to another vector or a pair of coordinates.

      Parameters

      • ...args: [number, number] | [Vector2d] | [ObservableVector2d]

        Either two numbers representing x and y coordinates or a single Vector2d object.

      Returns boolean

      True if the coordinates are equal, false otherwise.

      let v1 = new Vector2d(3, 4);
      let v2 = new Vector2d(3, 4);
      v1.equals(v2); // returns true
      let v = new Vector2d(3, 4);
      v.equals(3, 4); // returns true