Skip to content

Commit 5484100

Browse files
authored
Merge pull request phaserjs#5162 from samme/docs/arcade-physics-types
Add Arcade Physics types
2 parents 818343f + c0b6027 commit 5484100

10 files changed

Lines changed: 52 additions & 18 deletions

src/physics/arcade/Factory.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ var Factory = new Class({
104104
* @param {Phaser.GameObjects.GameObject} gameObject - A Game Object.
105105
* @param {boolean} [isStatic=false] - Create a Static body (true) or Dynamic body (false).
106106
*
107-
* @return {Phaser.GameObjects.GameObject} The Game Object.
107+
* @return {Phaser.Types.Physics.Arcade.GameObjectWithBody} The Game Object.
108108
*/
109109
existing: function (gameObject, isStatic)
110110
{
@@ -126,7 +126,7 @@ var Factory = new Class({
126126
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
127127
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
128128
*
129-
* @return {Phaser.Physics.Arcade.Image} The Image object that was created.
129+
* @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created.
130130
*/
131131
staticImage: function (x, y, key, frame)
132132
{
@@ -150,7 +150,7 @@ var Factory = new Class({
150150
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
151151
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
152152
*
153-
* @return {Phaser.Physics.Arcade.Image} The Image object that was created.
153+
* @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created.
154154
*/
155155
image: function (x, y, key, frame)
156156
{
@@ -174,7 +174,7 @@ var Factory = new Class({
174174
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
175175
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
176176
*
177-
* @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created.
177+
* @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created.
178178
*/
179179
staticSprite: function (x, y, key, frame)
180180
{
@@ -199,7 +199,7 @@ var Factory = new Class({
199199
* @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
200200
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
201201
*
202-
* @return {Phaser.Physics.Arcade.Sprite} The Sprite object that was created.
202+
* @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created.
203203
*/
204204
sprite: function (x, y, key, frame)
205205
{

src/physics/arcade/index.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@
77
var CONST = require('./const');
88
var Extend = require('../../utils/object/Extend');
99

10-
/**
11-
* @callback ArcadePhysicsCallback
12-
*
13-
* A callback receiving two Game Objects.
14-
*
15-
* When colliding a single sprite with a Group or TilemapLayer, `object1` is always the sprite.
16-
*
17-
* For all other cases, `object1` and `object2` match the same arguments in `collide()` or `overlap()`.
18-
*
19-
* @param {Phaser.GameObjects.GameObject} object1 - The first Game Object.
20-
* @param {Phaser.GameObjects.GameObject} object2 - The second Game Object.
21-
*/
22-
2310
/**
2411
* @namespace Phaser.Physics.Arcade
2512
*/
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @callback ArcadePhysicsCallback
3+
*
4+
* A callback receiving two Game Objects.
5+
*
6+
* When colliding a single sprite with a Group or TilemapLayer, `object1` is always the sprite.
7+
*
8+
* For all other cases, `object1` and `object2` match the same arguments in `collide()` or `overlap()`.
9+
*
10+
* @param {Phaser.Types.Physics.Arcade.GameObjectWithBody} object1 - The first Game Object.
11+
* @param {Phaser.Types.Physics.Arcade.GameObjectWithBody} object2 - The second Game Object.
12+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithBody
3+
*
4+
* @property {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithDynamicBody
3+
*
4+
* @property {Phaser.Physics.Arcade.Body} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.GameObjects.GameObject} Phaser.Types.Physics.Arcade.GameObjectWithStaticBody
3+
*
4+
* @property {Phaser.Physics.Arcade.StaticBody} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.Physics.Arcade.Image} Phaser.Types.Physics.Arcade.ImageWithDynamicBody
3+
*
4+
* @property {Phaser.Physics.Arcade.Body} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.Physics.Arcade.Image} Phaser.Types.Physics.Arcade.ImageWithStaticBody
3+
*
4+
* @property {Phaser.Physics.Arcade.StaticBody} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.Physics.Arcade.Sprite} Phaser.Types.Physics.Arcade.SpriteWithDynamicBody
3+
*
4+
* @property {Phaser.Physics.Arcade.Body} body
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @typedef {Phaser.Physics.Arcade.Sprite} Phaser.Types.Physics.Arcade.SpriteWithStaticBody
3+
*
4+
* @property {Phaser.Physics.Arcade.StaticBody} body
5+
*/

0 commit comments

Comments
 (0)