Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Game Objects
/
Sprites
Phaser 4.1.0
Phaser 4 examples
Sprites
9
examples
Examples
9
Create Sprites from Config
Demonstrates creating sprites using configuration objects, featuring dynamic value assignment through random integers, floats, arrays, and custom functions.
Custom Sprite Class
Demonstrates how to extend the Sprite class using ES6 syntax to create custom game objects with their own internal logic and preUpdate lifecycle methods.
Export Sprite to JSON
Demonstrates how to use the toJSON method to export a Sprite's current state—including position, rotation, scale, and alpha—into a serializable JSON object.
Moving a Sprite
Demonstrates how to move a Sprite across the screen by manually updating its position within the scene update loop.
Multiple Sprites
Load and display multiple independent Sprite objects at different coordinates within a single scene.
Rotate Around A Sprite
Demonstrates using Phaser.Math.RotateAroundDistance to create orbital motion where sprites rotate around the positions of other moving sprites.
Single Sprite
A basic example showing how to load an image and display it as a Sprite game object at a specific coordinate.
Sprite Alpha
Set the transparency of a Sprite using the alpha property.
Sprite Rotation
Demonstrates the difference between the angle (degrees) and rotation (radians) properties of a Sprite, featuring a visual guide of Phaser's circular coordinate system.