Class: Sprite

Sprite

new Sprite(bitmap)

The basic object that is rendered to the game screen.
NameTypeDescription
bitmapBitmapThe image for the sprite.

Extends

  • PIXI.Sprite

Members

bitmapBitmap

The bitmap for the sprite

blendModenumber

The blend mode to be applied to the sprite

heightnumber

The height of the sprite without the scale

opacitynumber

The opacity of the sprite (0 to 255)

widthnumber

The width of the sprite without the scale

Methods

destroy()

Destroys the sprite

getBlendColor()array

Gets the blend color for the sprite
Returns:
TypeDescription
arrayThe blend color [r, g, b, a]

getColorTone()array

Gets the color tone for the sprite
Returns:
TypeDescription
arrayThe color tone [r, g, b, gray]
Makes the sprite "hidden" (not visible)

initialize(bitmap)

Initializes the sprite
NameTypeDescription
bitmapBitmapThe bitmap of the sprite

move(x, y)

Sets the x and y coordiantes of the sprite
NameTypeDescription
xnumberThe x coordinate of the sprite
ynumberThe y coordinate of the sprite

setBlendColor(color)

Sets the blend color for the sprite
NameTypeDescription
colorarrayThe blend color [r, g, b, a]

setColorTone(tone)

Sets the color tone for the sprite
NameTypeDescription
tonearrayThe color tone [r, g, b, gray]

setFrame(x, y, width, height)

Sets the rectagle of the bitmap that the sprite displays
NameTypeDescription
xnumberThe x coordinate of the frame
ynumberThe y coordinate of the frame
widthnumberThe width of the frame
heightnumberThe height of the frame

setHue(hue)

Sets the hue rotation value
NameTypeDescription
huenumberThe hue value (-360, 360)
Removes the "hidden" state of the sprite, making it visible
Updates the sprite for each frame

updateVisibility()

Updates the visibility status of the sprite