Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Example of playing sprite animations using a loaded spritesheet in Phaser.
import Phaser from 'phaser';
class AnimationScene extends Phaser.Scene {
preload() {
this.load.spritesheet('walk', 'assets/walk.png', { frameWidth: 32, frameHeight: 48 });
}
create() {
this.anims.create({ key: 'run', frames: this.anims.generateFrameNumbers('walk', { start: 0, end: 3 }), frameRate: 6, repeat: -1 });
this.sprite = this.add.sprite(100, 200, 'walk').play('run');
}
}
new Phaser.Game({ type: Phaser.AUTO, width: 400, height: 400, scene: [AnimationScene] });Phaser is a fast, open-source 2D HTML5 game framework used to create browser-based games for desktop and mobile, using JavaScript or TypeScript with WebGL/Canvas rendering.
Origin & Creator
Phaser was created by Richard Davey (Photon Storm) to provide a powerful, accessible, open-source framework for modern HTML5 game creation.
Industrial Note
Phaser dominates the HTML5 gaming market, especially in educational games, advergames, casino & gambling front-ends, interactive marketing campaigns, and lightweight browser-based entertainment.