Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Group

The default group generate for create function.

It is recommended to use the group using as keys to facilitate the handling of removing / adding new sprites in the group.

import * as PIXI from 'pixi.js';
import Factory, { Utils, Group } from 'pixi-factory';
// ...
function setup() {
 const sprite: Utils.PIXISprite = Factory.Sprite.create(new PIXI.Sprite(resources.example.texture));
 const group: Group = Factory.Group.create([ sprite ], { container: app.stage });
 // ...
}

Hierarchy

  • Group

Constructors

constructor

Methods

A_debugger

  • A_debugger(PIXI: any): void
  • Create a debugger size for actually container render

    group.A_debugger(PIXI);
    

    Parameters

    • PIXI: any

      A pixi.js importer

    Returns void

E_hitEffect

  • E_hitEffect(target: PIXISprite, execute: function[]): void
  • Execute a multiple callback's if the target is collided with a group member.

    Callbacks are called in order of position in the past array.

    Callback return a PIXISprite that was hit.

    group.E_hitEffect(player_sprite, [
       (enemy_sprite: Utils.PIXISprite) => {
         console.log(enemy_sprite)
       },
       () => {
         console.log('hello world');
       },
    ]);
    

    Parameters

    • target: PIXISprite

      A target compare in hit a group sprites

    • execute: function[]

      A list for callback execute in a hit effect

    Returns void

E_inMaxArea

  • E_inMaxArea(target: PIXISprite, execute: function[]): void
  • Execute a callback target pertencent a max group area

    group.E_inMaxArea(player_sprite, [
       () => {
         console.log('hello', player_sprite.__TARGET_IN_GROUP_MAX_AREA)
       }
    ]);
    

    Parameters

    • target: PIXISprite

      A target compare in hit a group sprites

    • execute: function[]

      A list for callback execute in a hit effect

    Returns void

E_inMinArea

  • E_inMinArea(target: PIXISprite, execute: function[]): void
  • Execute a callback target pertencent a min group area

    group.E_inMinArea(player_sprite, [
       () => {
         console.log('hello', player_sprite.__TARGET_IN_GROUP_MIN_AREA)
       }
    ]);
    

    Parameters

    • target: PIXISprite

      A target compare in hit a group sprites

    • execute: function[]

      A list for callback execute in a hit effect

    Returns void

add

  • Insert a new sprite in a group

    Parameters

    Returns void

append

  • append(stage: any): Group
  • Parameters

    • stage: any

      A PIXI.Container for addChild

    Returns Group

    this

delete

  • Delete stage element and remove in group

    // ...
    group.add(sprite);
    
    setTimeout(() => {
      group.delete(0);
    }, 2000);
    // ...
    

    Parameters

    Returns void

get

  • Parameters

    Returns PIXISprite

    A Factory.Sprite in group list

getArea

getContainer

  • getContainer(): any
  • Returns any

    A PIXI.Container

gets

  • Returns PIXISprite[]

    A Factory.Sprite array

names

  • names(): string[]
  • Get names key

    Returns string[]

    Array with a name for keys

remove

  • Remove element in a track group events and actions (for delete render, use delete function instead).

    // ...
    group.add(sprite);
    
    setTimeout(() => {
      group.remove(0);
    }, 2000);
    // ...
    

    Parameters

    Returns void

setArea

  • Parameters

    Returns void

setContainer

  • setContainer(stage: any): void
  • Parameters

    • stage: any

      Set a new PIXI.Container

    Returns void

setSprites

  • Parameters

    Returns void

Generated using TypeDoc