{"library":"phaser","title":"Phaser HTML5 Game Framework","description":"Phaser is a robust, open-source HTML5 game framework designed for creating 2D games across desktop and mobile web browsers, currently stable at version 4.0.0. It leverages WebGL and Canvas rendering and has been under active development for over a decade. Version 4 represents a significant, ground-up rebuild of its WebGL renderer, featuring a new, node-based architecture that replaces the v3 pipeline system for enhanced performance and reliability, while striving to maintain a familiar API for developers. The framework offers an extensive suite of features for 2D game development, including advanced physics engines, sophisticated tweening systems, and web audio management. It supports development using both JavaScript and TypeScript and is compatible with various modern front-end frameworks. The project is commercially developed and maintained by Phaser Studio Inc. with strong community contributions, adhering to a release cadence that includes extensive pre-release candidates for major versions, ensuring a stable and well-tested core.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install phaser"],"cli":null},"imports":["import Phaser from 'phaser';","import Phaser from 'phaser';\nclass MyScene extends Phaser.Scene { /* ... */ }","import type Phaser from 'phaser';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Phaser from 'phaser';\n\nclass DemoScene extends Phaser.Scene {\n    constructor() {\n        super({ key: 'DemoScene' });\n    }\n\n    preload() {\n        // Load assets here if needed, e.g., this.load.image('logo', 'assets/phaser3-logo.png');\n    }\n\n    create() {\n        this.add.text(100, 100, 'Hello Phaser 4!', { font: '32px Arial', color: '#ffffff' });\n        console.log('Phaser 4 Demo Scene created!');\n\n        // Example: Add a simple tween\n        const circle = this.add.circle(400, 300, 50, 0xff0000);\n        this.tweens.add({\n            targets: circle,\n            x: 600,\n            duration: 2000,\n            ease: 'Power2',\n            yoyo: true,\n            loop: -1\n        });\n    }\n\n    update(time: number, delta: number) {\n        // Game logic updated every frame\n    }\n}\n\nconst config: Phaser.Types.Core.GameConfig = {\n    type: Phaser.AUTO,\n    width: 800,\n    height: 600,\n    backgroundColor: '#1a1a1a',\n    scene: DemoScene,\n    parent: 'game-container', // Ensure you have a div with id=\"game-container\" in your HTML\n    physics: {\n        default: 'arcade',\n        arcade: {\n            debug: false\n        }\n    }\n};\n\nnew Phaser.Game(config);","lang":"typescript","description":"This code sets up a minimal Phaser 4 game with a single scene, displaying a text object and animating a circle using tweens.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}