Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sprite

The Sprite object is the base for all textured objects that are rendered to the screen

A sprite can be created directly from an resource like this:

import * as PIXI from 'pixi.js';
import Factory from 'pixi-factory';
// ...
function setup() {
  const sprite = Factory.Sprite.create(new PIXI.Sprite(resources.example.texture));
  // ...
}

// or

import * as PIXI from 'pixi.js';
import { Sprite } from 'pixi-factory';
// ...
function setup() {
  const sprite = new Sprite().create(new PIXI.Sprite(resources.example.texture));
  // ...
}

Hierarchy

  • Sprite

Constructors

Methods

Constructors

constructor

  • Returns Sprite

Methods

create

  • Inserts new content into the object according to the preset options.

    This function does NOT create a new PIXI.Sprite, it just takes the source object and returns a new one with the requested contents.

    Factory.Sprite.create(new PIXI.Sprite(resources.example.texture), {
      bump: true, // hability a collision properties
      velocity: true, // hability a velocity base content
      d20rpg: true // hability a standard d20 rpg
      content: { ... } // append itens in a base sprite
    });
    

    Parameters

    Returns PIXISprite

    A new object sprites

Generated using TypeDoc