phaser/v2-community/resources/docgen/output/Phaser.Physics.Ninja.json
2016-11-23 00:17:46 +00:00

1 line
No EOL
18 KiB
JSON
Executable file

{"class":{"name":"Phaser.Physics.Ninja","extends":"","static":false,"constructor":true,"parameters":[{"name":"game","type":["Phaser.Game"],"help":"reference to the current game instance.","optional":false,"default":null}],"help":"Ninja Physics. The Ninja Physics system was created in Flash by Metanet Software and ported to JavaScript by Richard Davey.\\n\\nIt allows for AABB and Circle to Tile collision. Tiles can be any of 34 different types, including slopes, convex and concave shapes.\\n\\nIt does what it does very well, but is ripe for expansion and optimisation. Here are some features that I'd love to see the community add:\\n\\n* AABB to AABB collision\\n* AABB to Circle collision\\n* AABB and Circle 'immovable' property support\\n* n-way collision, so an AABB\/Circle could pass through a tile from below and land upon it.\\n* QuadTree or spatial grid for faster Body vs. Tile Group look-ups.\\n* Optimise the internal vector math and reduce the quantity of temporary vars created.\\n* Expand Gravity and Bounce to allow for separate x\/y axis values.\\n* Support Bodies linked to Sprites that don't have anchor set to 0.5\\n\\nFeel free to attempt any of the above and submit a Pull Request with your code! Be sure to include test cases proving they work."},"consts":[],"methods":{"public":[{"name":"clearTilemapLayerBodies","static":false,"returns":null,"help":"Clears all physics bodies from the given TilemapLayer that were created with `World.convertTilemap`.","line":231,"public":true,"protected":false,"private":false,"parameters":[{"name":"map","type":["Phaser.Tilemap"],"help":"The Tilemap to get the map data from.","optional":false,"default":null},{"name":"layer","type":["number","string","Phaser.TilemapLayer"],"help":"The layer to operate on. If not given will default to map.currentLayer.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"collide","static":false,"returns":null,"help":"Checks for collision between two game objects. You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.\\nThe second parameter can be an array of objects, of differing types.\\nThe objects are also automatically separated. If you don't require separation then use ArcadePhysics.overlap instead.\\nAn optional processCallback can be provided. If given this function will be called when two sprites are found to be colliding. It is called before any separation takes place,\\ngiving you the chance to perform additional checks. If the function returns true then the collision and separation is carried out. If it returns false it is skipped.\\nThe collideCallback is an optional function that is only called if two sprites collide. If a processCallback has been set then it needs to return true for collideCallback to be called.","line":346,"public":true,"protected":false,"private":false,"parameters":[{"name":"object1","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter","Phaser.TilemapLayer"],"help":"The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.TilemapLayer.","optional":false,"default":null},{"name":"object2","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter","Phaser.TilemapLayer","array"],"help":"The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.TilemapLayer.","optional":false,"default":null},{"name":"collideCallback","type":["function"],"help":"An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.","optional":true,"default":"null"},{"name":"processCallback","type":["function"],"help":"A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.","optional":true,"default":"null"},{"name":"callbackContext","type":["object"],"help":"The context in which to run the callbacks.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"convertTilemap","static":false,"returns":{"types":["array"],"help":"An array of the Phaser.Physics.Ninja.Tile objects that were created."},"help":"Goes through all tiles in the given Tilemap and TilemapLayer and converts those set to collide into physics tiles.\\nOnly call this *after* you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc.\\nEvery time you call this method it will destroy any previously created bodies and remove them from the world.\\nTherefore understand it's a very expensive operation and not to be done in a core game update loop.\\n\\nIn Ninja the Tiles have an ID from 0 to 33, where 0 is 'empty', 1 is a full tile, 2 is a 45-degree slope, etc. You can find the ID\\nlist either at the very bottom of `Tile.js`, or in a handy visual reference in the `resources\/Ninja Physics Debug Tiles` folder in the repository.\\nThe slopeMap parameter is an array that controls how the indexes of the tiles in your tilemap data will map to the Ninja Tile IDs.\\nFor example if you had 6 tiles in your tileset: Imagine the first 4 should be converted into fully solid Tiles and the other 2 are 45-degree slopes.\\nYour slopeMap array would look like this: `[ 1, 1, 1, 1, 2, 3 ]`.\\nWhere each element of the array is a tile in your tilemap and the resulting Ninja Tile it should create.","line":265,"public":true,"protected":false,"private":false,"parameters":[{"name":"map","type":["Phaser.Tilemap"],"help":"The Tilemap to get the map data from.","optional":false,"default":null},{"name":"layer","type":["number","string","Phaser.TilemapLayer"],"help":"The layer to operate on. If not given will default to map.currentLayer.","optional":true,"default":null},{"name":"slopeMap","type":["object"],"help":"The tilemap index to Tile ID map.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"enable","static":false,"returns":null,"help":"This will create a Ninja Physics body on the given game object or array of game objects.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.","line":132,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object","array","Phaser.Group"],"help":"The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.","optional":false,"default":null},{"name":"type","type":["number"],"help":"The type of Ninja shape to create. 1 = AABB, 2 = Circle or 3 = Tile.","optional":true,"default":"1"},{"name":"id","type":["number"],"help":"If this body is using a Tile shape, you can set the Tile id here, i.e. Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn, Phaser.Physics.Ninja.Tile.CONVEXpp, etc.","optional":true,"default":"1"},{"name":"radius","type":["number"],"help":"If this body is using a Circle shape this controls the radius.","optional":true,"default":"0"},{"name":"children","type":["boolean"],"help":"Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"enableAABB","static":false,"returns":null,"help":"This will create a Ninja Physics AABB body on the given game object. Its dimensions will match the width and height of the object at the point it is created.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.","line":83,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object","array","Phaser.Group"],"help":"The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.","optional":false,"default":null},{"name":"children","type":["boolean"],"help":"Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"enableBody","static":false,"returns":null,"help":"Creates a Ninja Physics body on the given game object.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the body is nulled.","line":188,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object"],"help":"The game object to create the physics body on. A body will only be created if this object has a null `body` property.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"enableCircle","static":false,"returns":null,"help":"This will create a Ninja Physics Circle body on the given game object.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.","line":98,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object","array","Phaser.Group"],"help":"The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.","optional":false,"default":null},{"name":"radius","type":["number"],"help":"The radius of the Circle.","optional":false,"default":null},{"name":"children","type":["boolean"],"help":"Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"enableTile","static":false,"returns":null,"help":"This will create a Ninja Physics Tile body on the given game object. There are 34 different types of tile you can create, including 45 degree slopes,\\nconvex and concave circles and more. The id parameter controls which Tile type is created, but you can also change it at run-time.\\nNote that for all degree based tile types they need to have an equal width and height. If the given object doesn't have equal width and height it will use the width.\\nA game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.","line":115,"public":true,"protected":false,"private":false,"parameters":[{"name":"object","type":["object","array","Phaser.Group"],"help":"The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.","optional":false,"default":null},{"name":"id","type":["number"],"help":"The type of Tile this will use, i.e. Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn, Phaser.Physics.Ninja.Tile.CONVEXpp, etc.","optional":true,"default":"1"},{"name":"children","type":["boolean"],"help":"Should a body be created on all children of this object? If true it will recurse down the display list as far as it can go.","optional":true,"default":"true"}],"inherited":false,"inheritedFrom":""},{"name":"overlap","static":false,"returns":null,"help":"Checks for overlaps between two game objects. The objects can be Sprites, Groups or Emitters.\\nYou can perform Sprite vs. Sprite, Sprite vs. Group and Group vs. Group overlap checks.\\nUnlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.\\nThe second parameter can be an array of objects, of differing types.","line":305,"public":true,"protected":false,"private":false,"parameters":[{"name":"object1","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter"],"help":"The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.","optional":false,"default":null},{"name":"object2","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter","array"],"help":"The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.","optional":false,"default":null},{"name":"overlapCallback","type":["function"],"help":"An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.","optional":true,"default":"null"},{"name":"processCallback","type":["function"],"help":"A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if processCallback returns true.","optional":true,"default":"null"},{"name":"callbackContext","type":["object"],"help":"The context in which to run the callbacks.","optional":true,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"separate","static":false,"returns":null,"help":"The core separation function to separate two physics bodies.","line":574,"public":true,"protected":false,"private":false,"parameters":[{"name":"body1","type":["Phaser.Physics.Ninja.Body"],"help":"The Body object to separate.","optional":false,"default":null},{"name":"body2","type":["Phaser.Physics.Ninja.Body"],"help":"The Body object to separate.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setBounds","static":false,"returns":null,"help":"Updates the size of this physics world.","line":207,"public":true,"protected":false,"private":false,"parameters":[{"name":"x","type":["number"],"help":"Top left most corner of the world.","optional":false,"default":null},{"name":"y","type":["number"],"help":"Top left most corner of the world.","optional":false,"default":null},{"name":"width","type":["number"],"help":"New width of the world. Can never be smaller than the Game.width.","optional":false,"default":null},{"name":"height","type":["number"],"help":"New height of the world. Can never be smaller than the Game.height.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"setBoundsToWorld","static":false,"returns":null,"help":"Updates the size of this physics world to match the size of the game world.","line":218,"public":true,"protected":false,"private":false,"parameters":[],"inherited":false,"inheritedFrom":""}],"protected":[],"private":[{"name":"collideGroupVsGroup","static":false,"returns":null,"help":"An internal function. Use Phaser.Physics.Ninja.collide instead.","line":550,"public":false,"protected":false,"private":true,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"collideGroupVsSelf","static":false,"returns":null,"help":"An internal function. Use Phaser.Physics.Ninja.collide instead.","line":522,"public":false,"protected":false,"private":true,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"collideHandler","static":false,"returns":null,"help":"Internal collision handler.","line":383,"public":false,"protected":false,"private":true,"parameters":[{"name":"object1","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter","Phaser.TilemapLayer"],"help":"The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.TilemapLayer.","optional":false,"default":null},{"name":"object2","type":["Phaser.Sprite","Phaser.Group","Phaser.Particles.Emitter","Phaser.TilemapLayer"],"help":"The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.TilemapLayer. Can also be an array of objects to check.","optional":false,"default":null},{"name":"collideCallback","type":["function"],"help":"An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.","optional":false,"default":null},{"name":"processCallback","type":["function"],"help":"A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.","optional":false,"default":null},{"name":"callbackContext","type":["object"],"help":"The context in which to run the callbacks.","optional":false,"default":null},{"name":"overlapOnly","type":["boolean"],"help":"Just run an overlap or a full collision.","optional":false,"default":null}],"inherited":false,"inheritedFrom":""},{"name":"collideSpriteVsGroup","static":false,"returns":null,"help":"An internal function. Use Phaser.Physics.Ninja.collide instead.","line":484,"public":false,"protected":false,"private":true,"parameters":[],"inherited":false,"inheritedFrom":""},{"name":"collideSpriteVsSprite","static":false,"returns":null,"help":"An internal function. Use Phaser.Physics.Ninja.collide instead.","line":464,"public":false,"protected":false,"private":true,"parameters":[],"inherited":false,"inheritedFrom":""}],"static":[]},"properties":{"public":[{"name":"bounds","type":["Phaser.Rectangle"],"help":"","inlineHelp":"The bounds inside of which the physics world exists. Defaults to match the world bounds.","line":49,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"game","type":["Phaser.Game"],"help":"","inlineHelp":"Local reference to game.","line":34,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"gravity","type":["number"],"help":"","inlineHelp":"The World gravity setting.","line":44,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"maxLevels","type":["number"],"help":"","inlineHelp":"Used by the QuadTree to set the maximum number of iteration levels.","line":59,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"maxObjects","type":["number"],"help":"","inlineHelp":"Used by the QuadTree to set the maximum number of objects per quad.","line":54,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"quadTree","type":["Phaser.QuadTree"],"help":"","inlineHelp":"The world QuadTree.","line":64,"default":null,"public":true,"protected":false,"private":false,"readOnly":false},{"name":"time","type":["Phaser.Time"],"help":"","inlineHelp":"Local reference to game.time.","line":39,"default":null,"public":true,"protected":false,"private":false,"readOnly":false}],"protected":[],"private":[]}}