
Phaser Gamedev
Configure and tune Phaser 3 Arcade Physics—world gravity, bodies, collisions, and debug—for browser or canvas-based indie games.
Install
npx skills add https://github.com/chongdashu/phaserjs-tinyswords --skill phaser-gamedevWhat is this skill?
- Arcade world config: gravity, debug overlays, fps, timeScale, checkCollision sides, quadtree useTree
- Dynamic body velocity, bounce, and physics.add.sprite or add.existing patterns
- Documented body properties and separation biases (overlapBias, tileBias, forceX)
- Reference depth for Phaser 3 default arcade physics pipeline
Adoption & trust: 974 installs on skills.sh; 37 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Game Enginegithub/awesome-copilot
Godot Gdscript Patternswshobson/agents
Unity Ecs Patternswshobson/agents
Game Developerjeffallan/claude-skills
Game Developmentsickn33/antigravity-awesome-skills
Unity Developerrmyndharis/antigravity-skills
Journey fit
Common Questions / FAQ
Is Phaser Gamedev safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Phaser Gamedev
# Arcade Physics Deep Dive Comprehensive reference for Phaser 3 Arcade Physics system. ## World Configuration ```javascript // In game config physics: { default: 'arcade', arcade: { gravity: { x: 0, y: 300 }, debug: true, // Show collision bodies debugShowBody: true, debugShowStaticBody: true, debugShowVelocity: true, debugBodyColor: 0xff00ff, debugStaticBodyColor: 0x0000ff, debugVelocityColor: 0x00ff00, fps: 60, // Physics update rate timeScale: 1, // 0.5 = half speed, 2 = double checkCollision: { up: true, down: true, left: true, right: true }, overlapBias: 4, // Overlap tolerance tileBias: 16, // Tile collision bias forceX: false, // Prioritize X-axis separation maxEntries: 16, // Quadtree max per node useTree: true // Spatial hash (false for >5000 bodies) } } ``` ## Body Types ### Dynamic Bodies Move, respond to velocity, gravity, and collisions. ```javascript // Create with physics enabled const player = this.physics.add.sprite(100, 100, 'player'); // Or add to existing sprite const sprite = this.add.sprite(100, 100, 'player'); this.physics.add.existing(sprite); // Body properties player.body.setVelocity(100, -200); player.body.setVelocityX(100); player.body.setVelocityY(-200); player.body.setBounce(0.5, 0.5); player.body.setDrag(100, 100); player.body.setFriction(0.5, 0.5); player.body.setMaxVelocity(300, 400); player.body.setGravityY(500); // Additional gravity player.body.setAcceleration(100, 0); player.body.setCollideWorldBounds(true); player.body.onWorldBounds = true; // Enable worldbounds event ``` ### Static Bodies Immovable, no velocity or gravity response. Efficient for platforms. ```javascript // Create static group const platforms = this.physics.add.staticGroup(); platforms.create(400, 568, 'ground'); // Or make existing body static sprite.body.setImmovable(true); sprite.body.moves = false; // After scaling/moving static bodies sprite.refreshBody(); ``` ## Body Sizing and Shape ```javascript // Custom body size sprite.body.setSize(width, height, center); sprite.body.setSize(32, 48, true); // Centered // Offset body from sprite sprite.body.setOffset(x, y); // Circular body (for rolling objects) sprite.body.setCircle(radius, offsetX, offsetY); sprite.body.setCircle(16, 0, 0); ``` ## Collision Detection ### Collider vs Overlap ```javascript // Collider: Physical collision, objects separate this.physics.add.collider(player, platforms); this.physics.add.collider(player, enemies, hitEnemy, null, this); // Overlap: Detect overlap without physical response this.physics.add.overlap(player, coins, collectCoin, null, this); function collectCoin(player, coin) { coin.disableBody(true, true); // (disableGameObject, hideGameObject) } ``` ### Collision Callbacks ```javascript // Process callback (return false to skip collision) function shouldCollide(player, enemy) { return !player.isInvincible; } this.physics.add.collider(player, enemies, hitEnemy, shouldCollide, this); ``` ### Collision Events ```javascript // World bounds event this.physics.world.on('worldbounds', (body, up, down, left, right) => { if (down) { // Hit bottom of world } }); // Enable on body first player.body.onWorldBounds = true; player.body.setCollideWorldBounds(true); ``` ## Groups ### Static Groups ```javascript const platforms = this.physics.add.staticGroup(); // Add children platforms.create(400, 568, 'ground'); platforms.createMultiple({ key: 'brick', repeat: 10, setXY: { x: 50, y: 300, stepX: 70 } }); // After modifying platforms.refresh(); ``` ### Dynamic Groups ```javascript const enemies = this.physics.add.group({ key: 'enemy', repeat: 5, setXY: { x: 100, y: 0, stepX: 100 } }); // Group defaults const bullets = this.physics.add.