Phaser 4 Arcade Physics movement and collision: bodies, velocity, gravity, colliders vs overlaps, groups and bullet pools. Use for a Phaser platformer or top-down controller, or a sprite that ignores physics, onFloor() always false or bodies passing through walls. Not for scenes and the loader (`phaser-core`), coyote time (`platformer`) or tunnelling theory (`physics-tuning`).
Ships in gamedev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Moves and collides sprites with Phaser's Arcade engine: axis-aligned rectangles and circles, no rotation in collision, no joints. That is enough for most platformers, shooters and top-down games, and it is fast. New projects target Phaser 4.2; check the installed major before editing an existing project. If the game needs hinges, springs, slopes or rotated polygons, Matter physics is the separate engine for that, and its bodies never collide with Arcade bodies.
physics: { default: 'arcade' }, or code calls this.physics.add.*,
body.setVelocity or this.physics.add.collider.phaser-core), jump-feel rules such as coyote time
(platformer), or fixed timestep and tunnelling in general (physics-tuning).physics: { default: 'arcade', arcade: { gravity: { x: 0, y: 600 }, debug: true } }. Body outlines and velocity lines answer most
"why didn't it collide" questions at a glance. Turn debug off before release.this.physics.add.sprite (dynamic),
this.physics.add.staticImage or staticGroup (walls and ground), or
this.physics.add.existing(obj) for an object you already made.x/y directly teleports the body past colliders.collider and overlap once in create. A collider separates bodies;
an overlap only reports contact (pickups, triggers, hurtboxes).maxSize.const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
arcade: {
gravity: { x: 0, y: 600 }, // top-down games use { x: 0, y: 0 }
debug: true, // body outlines and velocity while building
},
},
scene: [PlayScene],
};
update() {
const speed = 220;
const body = this.player.body;
body.setVelocity(0);
if (this.cursors.left.isDown) body.setVelocityX(-speed);
if (this.cursors.right.isDown) body.setVelocityX(speed);
if (this.cursors.up.isDown) body.setVelocityY(-speed);
if (this.cursors.down.isDown) body.setVelocityY(speed);
body.velocity.normalize().scale(speed); // diagonals at the same speed (zero stays zero)
}
create() {
this.platforms = this.physics.add.staticGroup();
this.platforms.create(400, 568, 'ground');
this.player = this.physics.add.sprite(100, 450, 'player');
this.player.setCollideWorldBounds(true);
this.player.body.setSize(20, 36, true); // hitbox tighter than the art, centred
this.physics.add.collider(this.player, this.platforms); // once, here
this.cursors = this.input.keyboard.createCursorKeys();
}
update() {
const onGround = this.player.body.blocked.down; // same as body.onFloor()
const dir = (this.cursors.right.isDown ? 1 : 0) - (this.cursors.left.isDown ? 1 : 0);
this.player.setVelocityX(dir * 160);
if (this.cursors.up.isDown && onGround) this.player.setVelocityY(-450);
}
// Push apart, then react.
this.physics.add.collider(this.player, this.enemies, (player, enemy) => this.hurt(player, enemy));
// Detect only. The optional 4th argument returns false to skip a pair before the callback.
this.physics.add.overlap(this.player, this.coins, (player, coin) => {
coin.disableBody(true, true); // deactivate and hide; the group can reuse it
this.registry.inc('score', 10);
});
create() {
this.bullets = this.physics.add.group({ defaultKey: 'bullet', maxSize: 30 });
}
fire(x, y) {
const bullet = this.bullets.get(x, y); // an inactive member, or a new one under maxSize
if (!bullet) return; // every bullet is in flight
bullet.enableBody(true, x, y, true, true);
bullet.body.setAllowGravity(false);
bullet.setVelocityY(-500);
}
update() {
// Return off-screen bullets to the pool, or firing stops after 30 shots.
for (const bullet of this.bullets.getChildren()) {
if (bullet.active && bullet.y < -32) bullet.disableBody(true, true);
}
}
npm run build (or npx tsc --noEmit) passes.phaser-core's headless smoke script is in use, put this body
in its page.evaluate(() => { ... }) after a two-second wait, adjusting the scene key and
object names:const s = window.game.scene.getScene('play');
return {
bodies: s.physics.world.bodies.size, // dynamic bodies alive
staticBodies: s.physics.world.staticBodies.size,
playerOnFloor: s.player.body.blocked.down, // true once the player has landed
playerY: Math.round(s.player.y),
};
Expect playerOnFloor: true and a playerY resting on the ground for a platformer, and a
body count that stays flat while firing (the pool is recycling).
3. With debug: true, take a screenshot and check that hitboxes sit on the art. Without
browser automation, ask the user to run with debug: true and report whether the outlines
match the sprites and where the player stops.
this.add.sprite, so it has no body. Use
this.physics.add.sprite or this.physics.add.existing(obj).onFloor() is always false → nothing to land on: add the collider with the ground,
and check gravity is on. Landing on an ordinary dynamic body does not set blocked; make
platforms static, immovable (setImmovable(true)) or non-pushable (setPushable(false)).staticGroup, or
setImmovable(true) for moving platforms.body.updateFromGameObject() (or refreshBody() on the object).setMaxVelocity, or raise arcade.fps above its default 60 at CPU cost.1. Widen
the other side's mask too, and set a group and its members separately (see the reference).collider/overlap was called in
update, adding a new one every frame. Register once in create; disable with
collider.active = false.disableBody(true, true).references/bodies-and-collision.md when tuning
drag, bounce or max velocity, shaping hitboxes with setSize/setCircle/setOffset,
filtering pairs with collision categories or a process callback, reading touching vs
blocked, or listening for worldbounds events.phaser-core: game config, scenes, loader and cameras.platformer: coyote time, jump buffering, variable jump height and level structure.physics-tuning: engine-neutral feel, timestep, tunnelling and jitter.level-design: the tile and platform layouts these bodies collide with.Last verified: 2026-11-11 against Phaser 4.2.1 (npm latest, published 2026-07-09).
arcade.fps defaults to 60 and fixedStep to true; bodies,
static bodies and static groups start in category 1 with mask 1; a dynamic group's mask is
all bits; nextCategory() allows 32 categories; drag applies only at zero acceleration.npm view phaser dist-tags.What SKILL.md sets; muted values are Claude Code's defaults
/gamedev:phaser-arcade-physicsfrom gamedev
npx claudepluginhub cirobarone78/games-skill --plugin gamedevOther plugins' skills for the same job
80 skills in this plugin
/ai-behavior-trees-utility-aiEngine-neutral behavior tree and utility AI code for NPCs in any language: Blackboard, reactive composites, decorators and response-curve scoring. Use when an enemy keeps chasing after losing sight, restarts its action every frame or flip-flops between choices. Not for FSMs, steering or pathfinding (`game-ai`) or Unreal BT, EQS and StateTree (`unreal-behavior-trees`).
/audio-designEngine-neutral game audio technique: bus layout, volume sliders in decibels, loudness, ducking music under dialogue, adaptive music and SFX variation, with Godot, Unity and FMOD/Wwise mappings. Use when mixing a game, making music react to combat, fixing repetitive footsteps or beat sync, or a mix that clips or pumps. Not for the Godot audio API (`godot-audio`).
/