ecspresso
    Preparing search index...

    Function createTransform

    • Create both local and world transform components. World transform is initialized to match local transform.

      Parameters

      • x: number

        The x coordinate

      • y: number

        The y coordinate

      • Optionaloptions: TransformOptions

        Optional rotation and scale

      Returns TransformComponentTypes

      Component object suitable for spreading into spawn()

      ecs.spawn({
      ...createTransform(100, 200),
      sprite,
      });

      // With rotation and scale
      ecs.spawn({
      ...createTransform(100, 200, { rotation: Math.PI / 4, scale: 2 }),
      sprite,
      });