Static Physics Sprite Class
Demonstrates creating a custom class that extends an Arcade Physics Sprite to define a static level exit with a specific texture frame and origin.
1024 × 768
import SPRITE_KEYS from "../spriteKeys.js";
export class Exit extends Phaser.Physics.Arcade.Sprite
{
constructor (scene, x, y)
{
super(scene, x, y, SPRITE_KEYS.FANTASY_TILES, 31);
this.setOrigin(0, 0);
scene.add.existing(this);
scene.physics.add.existing(this, true);
}
}More in GameObjects13 examples
Treasure Box Game ObjectA custom Arcade Physics Sprite class representing a treasure box that changes its animation frame and triggers a key spawn when activated.Animated Coin Collection EffectDemonstrates a custom Sprite class that manages its own spin animation, yoyo tween movement, sound effects, and self-destruction upon completion.Automated Sprite AI (Chick)A custom Arcade Physics Sprite class demonstrating automated movement, jumping on a timer, and collision-based direction switching.Bomb Sprite ClassAn example of extending the Arcade Physics Sprite class to create a custom bomb object with randomized velocity, angular rotation, and world bounds collision.