All Projects → liabru → matter-wrap

liabru / matter-wrap

Licence: MIT license
a coordinate wrapping plugin for matter-js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to matter-wrap

XcodeCommentWrapper
Xcode extension for wrapping comments
Stars: ✭ 29 (+11.54%)
Mutual labels:  wrap
wrap
A Fountain export tool with some extras...
Stars: ✭ 44 (+69.23%)
Mutual labels:  wrap
RT-Thread-wrapper-of-uCOS-II
RT-Thread操作系统的uCOS-II兼容层:让基于uC/OS-II操作系统开发的应用层无感地迁移到RT-Thread操作系统 | A wrapper which can make codes developed by uCOS-II APIs directly run on RT-Thread
Stars: ✭ 24 (-7.69%)
Mutual labels:  wrap
beautiful-capi
Beautiful Capi is a tool which automates the creation of compiler-independent and binary compatible C++ libraries across different C++ compilers
Stars: ✭ 31 (+19.23%)
Mutual labels:  wrap
auto-async-wrap
automatic async middleware wrapper for expressjs errorhandler.
Stars: ✭ 21 (-19.23%)
Mutual labels:  wrap
visual-ts-game-engine
Typescript project based on matter.ts implementation."This version 2 of visualjs game engine, totally different approach. Whole project is based fully dependency build. Main file is app.ts and ioc.ts. Class ioc saves singleton instances also bind. In this project html and css is also present, webpack helps and handle this type of files. GamePlay…
Stars: ✭ 15 (-42.31%)
Mutual labels:  matter-js

matter-wrap

A coordinate wrapping plugin for matter.js

Build Status

This plugin allows you to automatically wrap the position of bodies and composites such that they always stay within the given bounds. Upon crossing a boundary the body will appear on the opposite side of the bounds, while maintaining its velocity. An example of this effect can be seen in the classic Asteroids and Pacman games.

Demo

See the demo.

matter-wrap

Install

Get the matter-wrap.js file directly or get it via npm:

npm install matter-wrap

Dependencies

Usage

Matter.use('matter-wrap');
// or
Matter.use(MatterWrap);

See Using Plugins for more information.

An example of a body that wraps between the bounds (0, 0) and (1024, 1024). For wrapping composites set composite.plugin.wrap as below.

var body = Matter.Bodies.circle(0, 0, 10, {
  plugin: {
    wrap: {
      min: {
        x: 0,
        y: 0
      },
      max: {
        x: 1024,
        y: 1024
      }
    }
  }
);

Examples

Check out the examples.

Documentation

See the API docs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].