How to use the matter-js.Engine.clear function in matter-js

To help you get started, we’ve selected a few matter-js examples, based on popular ways it is used in public projects.

github plinko-team / plinko / src / server / serverEngine.js View on Github external
resetGame() {
    this.logged = false;
    this.activeUsers = new UserCollection();
    // this.unregisterPhysicsEvents()

    this.chips = {};
    this.pegs = [];
    Engine.clear(this.engine);

    delete this.engine;
    delete this.gameloop;

    this.frame = 0;
    this.inputBuffer = new InputBuffer();

    this.winner = false;

    this.initializeScore();
  }
github GraphQLCollege / graphql-college / components / Burger.js View on Github external
bodies = bodies.concat([
            selectTopBun(this.props.burger),
            ...selectPatty(this.props.burger),
            bottomBun
          ]);
        }
      } else {
        if (this.props.burger.bun) {
          bodies = bodies.concat([selectTopBun(this.props.burger), bottomBun]);
        }
      }
    }

    Render.stop(this.matterRender);
    World.clear(this.matterEngine.world);
    Engine.clear(this.matterEngine);

    World.add(this.matterEngine.world, bodies);

    Engine.run(this.matterEngine);

    Render.run(this.matterRender);
  };
  render() {