GithubHelp home page GithubHelp logo

danielart / grid-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from annoraaq/grid-engine

0.0 0.0 0.0 35.1 MB

An exceptional plugin for grid-based features in the Phaser 3 framework.

Home Page: https://annoraaq.github.io/grid-engine/

License: Apache License 2.0

JavaScript 0.41% TypeScript 99.11% HTML 0.48%

grid-engine's Introduction

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)
  • Multiple character layers (Beta)
  • Collision groups

๐Ÿ“– Read our most current documentation.

โžก๏ธ You can try/download a list of examples.

๐Ÿ›  Also check out the Chrome DevTools plugin.

Installation

Installing the Grid Engine plugin is simple.

NPM

npm i --save grid-engine

Web

<!-- Download the .zip and copy GridEngine.min.js from dist directory -->
<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 Engine in your scenes!

function create() {
  // ...

  const gridEngineConfig = {
    characters: [
      {
        id: "player",
        sprite: playerSprite,
        walkingAnimationMapping: 6,
      },
    ],
  };

  this.gridEngine.create(tilemap, gridEngineConfig);

  // ...
}

Example GIFs

Special Thanks

splashsky, therebelrobot, xLink

License

Apache 2.0

grid-engine's People

Contributors

annoraaq avatar dependabot[bot] avatar github-actions[bot] avatar jasoncabot avatar therebelrobot avatar zewa666 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.