Sprite Manager

Moves the flat pictures in a 2D game and tells you when two of them touch. Use it with Sprite Store, which holds the pictures it shows.

Text, Stickers & 2D Graphics

Stickers, speech bubbles, frames, and on-screen text and graphics.

Made with this block

Functions

getScreenSizevec2

Get the actual screen size in pixels

getFaceTextureTexture

Get the user's face texture

getFacialFeatureTextureTexture

Allows getting a texture of a user facial feature

createSpriteObject

Creates a new Sprite object, attaches it to the root of the Scene Graph managed by the SpriteManager, and returns it.

getRootObject

Returns the root Sprite object of the scene graph. All top-level sprites are children of this root.

hitTestObject

Performs a hit test for all sprites in the scene against a given screen point in pixels. Returns an array of Sprite objects that were hit.

isIntersectingboolean

Checks if two sprites are intersecting (overlapping). Always use this function or Sprite.intersects, don't develop your own intersection logic.

removeAllvoid

Removes and destroys all the sprites in the scene. You cannot reuse previously created sprites after this.

unitToPixelvec2

Converts between normalized unit coordinates where (0,0)=top-left and (1,1)=bottom-right to pixel coordinates (0,0)=top-left and (screenWidth,screenHeight)=bottom-right. Use this function to translate touch events coords received from the Touch Events block to pixel coordinates that Sprite Manager is operating in.

pixelToUnitvec2

Translates between screen pixel coordinates (0,0)=top-left and (screenWidth,screenHeight)=bottom-right into normalized unit coordinates where (0,0)=top-left and (1,1)=bottom-right.