melonJS
    Preparing search index...

    Function getImage

    • Get a loaded image (an "image" asset, or the image of an "aseprite" one). Given a path, its directory and extension are ignored, so getImage("data/img/player.png") finds the image named "player". Most engine classes take the name instead, and look it up themselves: new Sprite(0, 0, { image: "player" }).

      Parameters

      • image: string

        the asset name

      Returns HTMLImageElement | CompressedImage | null

      the image, or null if none is loaded under that name

      const player = loader.getImage("player");
      console.log(player.width, player.height);