Giter VIP home page Giter VIP logo

box2dweb-exporter-physicseditor's Introduction

box2dweb-exporter-physicseditor

Custom exporter for Box2DWeb for use with PhysicsEditor from CodeAndWeb
Exported script is an ES6/2015 module

By default, the script is set up to import the ES2015 Module, box2dweb-haircut:
https://www.npmjs.com/package/box2dweb-haircut

The import of a CommonJS module of Box2DWeb is included in the comments:
https://www.npmjs.com/package/box2dweb

If you need an ES5 version, download version 1.0.2

Directions:

  • Set your custom exporter directory in your preferences for PE.
  • Place the folder named box2d-js-es6 in your custom exporter directory.
  • After publishing and adding the script to your app, create the bodies like so:

    import Box2D from 'box2dweb-haircut';
    import PhysicsData from 'PhysicsData';

    /*
        PE default ptm ratio is 32 and can be edited in the PE UI.
        If you need to adjust the ptm ratio after publishing, plug the number into the constructor
    */
    const physicsData = new PhysicsData(64);

    /* created your bodies - args: bodyName, world, bodyType, userData */
    const brainBody = physicsData.createBody('brain',
        world,
        Box2D.Dynamics.b2Body.b2_dynamicBody,
        {
            sprite: brainSprite,
            ratio: 64,
            update: b => {...}
        }
    );

box2dweb-exporter-physicseditor's People

Contributors

aashby13 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.