UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.

132 lines (112 loc) 3.26 kB
/** * This module has now been replaced by `Matter.Composite`. * * All usage should be migrated to the equivalent functions found on `Matter.Composite`. * For example `World.add(world, body)` now becomes `Composite.add(world, body)`. * * The property `world.gravity` has been moved to `engine.gravity`. * * For back-compatibility purposes this module will remain as a direct alias to `Matter.Composite` in the short term during migration. * Eventually this alias module will be marked as deprecated and then later removed in a future release. * * @class World * @extends Composite */ var World = {}; module.exports = World; var Composite = require('./Composite'); (function() { /** * See above, aliases for back compatibility only */ World.create = Composite.create; World.add = Composite.add; World.remove = Composite.remove; World.clear = Composite.clear; World.addComposite = Composite.addComposite; World.addBody = Composite.addBody; World.addConstraint = Composite.addConstraint; /* * * Properties Documentation * */ /** * The gravity to apply on the world. * * @property gravity * @type object */ /** * The gravity x component. * * @property gravity.x * @type object * @default 0 */ /** * The gravity y component. * * @property gravity.y * @type object * @default 1 */ /** * The gravity scale factor. * * @property gravity.scale * @type object * @default 0.001 */ /** * A `Bounds` object that defines the world bounds for collision detection. * * @property bounds * @type bounds * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } */ // World is a Composite body // see src/module/Outro.js for these aliases: /** * An alias for Composite.add * @method add * @param {world} world * @param {} object * @return {composite} The original world with the objects added */ /** * An alias for Composite.remove * @method remove * @param {world} world * @param {} object * @param {boolean} [deep=false] * @return {composite} The original world with the objects removed */ /** * An alias for Composite.clear * @method clear * @param {world} world * @param {boolean} keepStatic */ /** * An alias for Composite.addComposite * @method addComposite * @param {world} world * @param {composite} composite * @return {world} The original world with the objects from composite added */ /** * An alias for Composite.addBody * @method addBody * @param {world} world * @param {body} body * @return {world} The original world with the body added */ /** * An alias for Composite.addConstraint * @method addConstraint * @param {world} world * @param {constraint} constraint * @return {world} The original world with the constraint added */ })();