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.
Stickers, speech bubbles, frames, and on-screen text and graphics.
Made with this blockFunctions
getScreenSizevec2Get the actual screen size in pixels
getFaceTextureTextureGet the user's face texture
getFacialFeatureTextureTextureAllows getting a texture of a user facial feature
createSpriteObjectCreates a new Sprite object, attaches it to the root of the Scene Graph managed by the SpriteManager, and returns it.
getRootObjectReturns the root Sprite object of the scene graph. All top-level sprites are children of this root.
hitTestObjectPerforms 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.
isIntersectingbooleanChecks if two sprites are intersecting (overlapping). Always use this function or Sprite.intersects, don't develop your own intersection logic.
removeAllvoidRemoves and destroys all the sprites in the scene. You cannot reuse previously created sprites after this.
unitToPixelvec2Converts 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.
pixelToUnitvec2Translates 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.
More in Text, Stickers & 2D Graphics
- Comic StripStacks your pictures into a vertical comic strip that you scroll through. Add your own images, or say what each panel shows, for example a short story about a lost dog.
- Decorative Camera OverlayAdds a decorative layer on top of the camera picture, such as sparkles, confetti or falling snow. Pick from a set of ready-made effects, for example a night sky of stars.
- Lens Frame 2DAdds a flat border around the edge of the screen. Say what the border should look like, for example a film strip or a ring of flowers.
- Sticker On FacePuts one flat sticker on your forehead or cheek, and it follows your face as you move. Say what the sticker shows, for example a heart or a banana.
- Sticker On ScreenPuts one sticker on the screen at the position, size and angle you choose. Say what the sticker shows and where it sits, for example a heart in the top corner.
- Text On HeadAdds text that floats above your head and follows it as you move. Choose the words, the font, the color and whether the text has an outline, a shadow or a background.
- Text On ScreenAdds text anywhere on the screen, at the size, angle and color you choose. Anyone who opens the Lens can edit the words, if you ask for that.
