Interface SpritesAPI


public interface SpritesAPI
Factory API for runtime sprite entities.

Spawned sprites use assets from the current scene atlas. The asset must be included in Runtime Availability before export, otherwise spawning fails with an IllegalArgumentException.

  • Method Summary

    Modifier and Type
    Method
    Description
    spawn(int assetId, float x, float y)
    Creates a sprite entity from an asset id at world position (x, y).
    spawn(String name, float x, float y)
    Creates a sprite entity from an asset name at world position (x, y).
  • Method Details

    • spawn

      SpriteRef spawn(int assetId, float x, float y)
      Creates a sprite entity from an asset id at world position (x, y).
      Parameters:
      assetId - exported asset id to use for the sprite region
      x - initial world x position
      y - initial world y position
      Returns:
      fluent reference to the created sprite entity
      Throws:
      IllegalArgumentException - when the asset is not available in the current scene atlas
    • spawn

      SpriteRef spawn(String name, float x, float y)
      Creates a sprite entity from an asset name at world position (x, y).
      Parameters:
      name - exported asset name to use for the sprite region
      x - initial world x position
      y - initial world y position
      Returns:
      fluent reference to the created sprite entity
      Throws:
      IllegalArgumentException - when the asset is not available in the current scene atlas