All Downloads are FREE. Search and download functionalities are using the official Maven repository.

view.entity-module.TextureBasedEntity.js Maven / Gradle / Ivy

Go to download

Entity Manager module for the CodinGame engine toolkit. Simplify the management of shapes and drawings.

There is a newer version: 4.5.0
Show newest version
import { Entity } from './Entity.js'

/* global PIXI */

export class TextureBasedEntity extends Entity {
  static defaultAnchor () {
    return 0
  }

  constructor () {
    super()
    Object.assign(this.defaultState, {
      anchorX: TextureBasedEntity.defaultAnchor(),
      anchorY: TextureBasedEntity.defaultAnchor(),
      blendMode: PIXI.BLEND_MODES.NORMAL,
      tint: 0xFFFFFF
    })
  }

  initDisplay () {
    super.initDisplay()
  }

  updateDisplay (state, changed, globalData) {
    super.updateDisplay(state, changed, globalData)
    this.graphics.anchor.set(state.anchorX, state.anchorY)
    this.graphics.blendMode = state.blendMode
    this.graphics.tint = state.tint
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy