Merge pull request #5162 from samme/docs/arcade-physics-types

Add Arcade Physics types
This commit is contained in:
Richard Davey 2020-07-13 12:27:54 +01:00 committed by GitHub
commit 54841002eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 52 additions and 18 deletions

View file

@ -104,7 +104,7 @@ var Factory = new Class({
* @param {Phaser.GameObjects.GameObject} gameObject - A Game Object.
* @param {boolean} [isStatic=false] - Create a Static body (true) or Dynamic body (false).
*
* @return {Phaser.GameObjects.GameObject} The Game Object.
* @return {Phaser.Types.Physics.Arcade.GameObjectWithBody} The Game Object.
*/
existing: function (gameObject, isStatic)
{
@ -126,7 +126,7 @@ var Factory = new Class({
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Arcade.Image} The Image object that was created.
* @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created.
*/
staticImage: function (x, y, key, frame)
{
@ -150,7 +150,7 @@ var Factory = new Class({
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Arcade.Image} The Image object that was created.
* @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created.
*/
image: function (x, y, key, frame)
{
@ -174,7 +174,7 @@ var Factory = new Class({
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created.
* @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created.
*/
staticSprite: function (x, y, key, frame)
{
@ -199,7 +199,7 @@ var Factory = new Class({
* @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
*
* @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created.
* @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created.
*/
sprite: function (x, y, key, frame)
{

View file

@ -7,19 +7,6 @@
var CONST = require('./const');
var Extend = require('../../utils/object/Extend');
/**
* @callback ArcadePhysicsCallback
*
* A callback receiving two Game Objects.
*
* When colliding a single sprite with a Group or TilemapLayer, `object1` is always the sprite.
*
* For all other cases, `object1` and `object2` match the same arguments in `collide()` or `overlap()`.
*
* @param {Phaser.GameObjects.GameObject} object1 - The first Game Object.
* @param {Phaser.GameObjects.GameObject} object2 - The second Game Object.
*/
/**
* @namespace Phaser.Physics.Arcade
*/

View file

@ -0,0 +1,12 @@
/**
* @callback ArcadePhysicsCallback
*
* A callback receiving two Game Objects.
*
* When colliding a single sprite with a Group or TilemapLayer, `object1` is always the sprite.
*
* For all other cases, `object1` and `object2` match the same arguments in `collide()` or `overlap()`.
*
* @param {Phaser.Types.Physics.Arcade.GameObjectWithBody} object1 - The first Game Object.
* @param {Phaser.Types.Physics.Arcade.GameObjectWithBody} object2 - The second Game Object.
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithBody
*
* @property {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithDynamicBody
*
* @property {Phaser.Physics.Arcade.Body} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithStaticBody
*
* @property {Phaser.Physics.Arcade.StaticBody} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.Physics.Arcade.Image} Phaser.Types.Physics.Arcade.ImageWithDynamicBody
*
* @property {Phaser.Physics.Arcade.Body} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.Physics.Arcade.Image} Phaser.Types.Physics.Arcade.ImageWithStaticBody
*
* @property {Phaser.Physics.Arcade.StaticBody} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.Physics.Arcade.Sprite} Phaser.Types.Physics.Arcade.SpriteWithDynamicBody
*
* @property {Phaser.Physics.Arcade.Body} body
*/

View file

@ -0,0 +1,5 @@
/**
* @typedef {Phaser.Physics.Arcade.Sprite} Phaser.Types.Physics.Arcade.SpriteWithStaticBody
*
* @property {Phaser.Physics.Arcade.StaticBody} body
*/