npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

arcade-physics

v0.2.1

Published

Standalone 2D Arcade Physics for JavaScript games, based on Phaser's Arcade Physics. Supports AABB and circle bodies, collisions, overlaps, and tilemaps.

Readme

2D arcade physics for JavaScript games, extracted from the Arcade Physics module of Phaser. It runs without the Phaser game framework.

It runs in browsers, on Node.js (tested with 22), and on Bun (tested with 1.2).

Goal

Detach Arcade Physics from the Phaser package so it can be used on its own in any JavaScript game or canvas project.

Features

  • AABB and circle bodies, static bodies, gravity, bounce, friction, and world bounds
  • Collisions and overlaps between bodies
  • Tilemap collisions with createTilesFromGrid, collideBodyVsTiles, and overlapBodyVsTiles
  • DebugGraphics for drawing body outlines
  • Group support has been removed. Use a plain array instead of a Group.

Demo (client-side)

https://yandeu.github.io/arcade-physics/

Also available on html2app: https://html2app.dev/tools/arcade-physics

The demo pages are in demo/: index.html, tilemap.html, and server.html, which shows a Node.js and Bun script with its console output.

NPM

npm i arcade-physics

Usage

import { LoadArcadePhysics } from "arcade-physics";

const physics = await LoadArcadePhysics({
  width: 800,
  height: 450,
  gravity: { x: 0, y: 300 },
});

const box = physics.add.body(20, 20, 64, 64);
box.setBounce(0.6);
box.setCollideWorldBounds(true);

const platform = physics.add.staticBody(60, 350, 160, 32);
physics.add.collider(box, platform);

let tick = 0;
setInterval(() => {
  physics.world.update(tick * 1000, 1000 / 60);
  physics.world.postUpdate();
  tick++;
}, 16);

For a complete example, see the config and setup in demo/index.html.

Bundles (without npm)

If your page is not built with a bundler, use one of the prebuilt bundles. Each bundle contains the whole library, including Phaser's physics code.

| File | Format | Use it with | | ----------------------------------- | ------ | ---------------------------------------------- | | bundles/arcade-physics.esm.min.js | ESM | <script type="module"> | | bundles/arcade-physics.umd.min.js | UMD | <script>, exposes the global ArcadePhysics |

The bundles do not include TypeScript declarations. Use the npm package for types.

Download a bundle into the same folder as your HTML page:

curl -O https://unpkg.com/arcade-physics/bundles/arcade-physics.umd.min.js

Plain HTML with the UMD bundle

<!DOCTYPE html>
<html>
  <body>
    <script src="arcade-physics.umd.min.js"></script>
    <script>
      ArcadePhysics.LoadArcadePhysics({
        width: 800,
        height: 450,
        gravity: { x: 0, y: 300 },
      }).then((physics) => {
        const box = physics.add.body(20, 20, 64, 64);
        console.log("box", box.x, box.y);
      });
    </script>
  </body>
</html>

Plain HTML with the ESM bundle

index.html:

<!DOCTYPE html>
<html lang="en">
  <body>
    <script type="module" src="app.js"></script>
  </body>
</html>

app.js (same folder, next to arcade-physics.esm.min.js):

import { LoadArcadePhysics } from "./arcade-physics.esm.min.js";

const physics = await LoadArcadePhysics({
  width: 800,
  height: 450,
  gravity: { x: 0, y: 300 },
});
const box = physics.add.body(20, 20, 64, 64);
console.log("box", box.x, box.y);

The ESM bundle must be served over HTTP(S), because browsers block module scripts loaded from file://. The UMD bundle works when you open the HTML file directly.

Development

git clone https://github.com/yandeu/arcade-physics.git
cd arcade-physics
npm run init      # fetches the pinned Phaser source into src/phaser
npm install
npm run build     # writes dist/ (npm entry and types), dist/arcade-physics.min.js, and bundles/
npm test

License

MIT License. Copyright (c) 2026 Yannick Deubel

This project includes code from third-party MIT licensed projects. Their copyright notices and license texts are included in the banner at the top of dist/index.js. The type definitions in dist/phaser.d.ts and dist/matter.d.ts start with Phaser's license notice.

  • Phaser, Copyright (c) 2013-2026 Richard Davey, Phaser Studio Inc.
  • eventemitter3, Copyright (c) 2014 Arnout Kazemier
  • rbush, Copyright (c) 2024 Volodymyr Agafonkin. Phaser's RTree.js is a fork of this code.

See the LICENSE file for more details.