Nitrogenous Polymorphic Molecule
    Have ideas to improve npm?Join in the discussion! »

    grid-engine
    TypeScript icon, indicating that this package has built-in type declarations

    1.14.1 • Public • Published

    Welcome to the Grid Engine plugin! This Phaser 3 plugin adds grid-based movement to your tilemap game. Your characters will be able to only move in whole tile sizes, locked to the x-y grid!

    This plugin is also compatible (and written in) TypeScript; enjoy full type support!

    Features

    • Grid-based movement, of course!
    • Tile-based collision detection
    • One-way collision detection
    • Support for multiple characters
    • Pathfinding (for both NPCs and the player)
    • Random movement (can also limit to a radius)
    • Following other characters
    • Diagonal movement (8 directions)
    • Isometric maps (Beta)

    📖 Our most current documentation is here! ➡️ You can try/download a list of examples at this link here.

    Installation

    Installing the Grid Movement plugin is simple.

    NPM

    npm i --save grid-engine

    Web

    <!-- Download the .zip and copy GridEngine.min.js from dist/ -->
    <script src="GridEngine.min.js"></script>

    Then, inside your Phaser game config...

    const gameConfig = {
      // ...
    
      plugins: {
        scene: [
          {
            key: "gridEngine",
            plugin: GridEngine,
            mapping: "gridEngine",
          },
        ],
      },
    
      // ...
    };
    
    const game = new Phaser.Game(gameConfig);

    Now you're all set to start using Grid Movement in your scenes!

    function create() {
      // ...
    
      const gridEngineConfig = {
        characters: [
          {
            id: "player",
            sprite: playerSprite,
            walkingAnimationMapping: 6,
          },
        ],
      };
    
      this.gridEngine.create(tilemap, gridEngineConfig);
    
      // ...
    }

    Example GIFs

    Install

    npm i grid-engine

    DownloadsWeekly Downloads

    158

    Version

    1.14.1

    License

    ISC

    Unpacked Size

    2.23 MB

    Total Files

    39

    Last publish

    Collaborators

    • avatar