Source Academy Modules
    Preparing search index...

    Function gameobjects_overlap

    • Checks if two gameobjects overlap with each other, using a rectangular bounding box. This bounding box is rectangular, for all GameObjects. This function should be called in your update function.

      Parameters

      • gameObject1: InteractableGameObject

        The first gameobject reference.

      • gameObject2: InteractableGameObject

        The second gameobject reference.

      Returns boolean

      True, if both gameobjects overlap with each other.

      const rectangle1 = create_rectangle(100, 100);
      const rectangle2 = create_rectangle(100, 100);
      if (gameobjects_overlap(rectangle1, rectangle2)) {
      // Both rectangles overlap
      }