Skip to content

Commit 0af1681

Browse files
committed
Refactored GameObjects to GameObject.
1 parent fb13151 commit 0af1681

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+681
-681
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"env": {
33
"browser": true,
4-
"es6"
4+
"es6": true
55
},
66
"extends": "eslint:recommended",
77
"globals": {

src/Phaser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ var Phaser = Phaser || { // jshint ignore:line
542542
NEAREST: 1
543543
},
544544

545-
GameObjects: {},
546-
545+
Component: {},
546+
GameObject: {},
547547
Renderer: {},
548548

549549
tempMatrix: null
File renamed without changes.

src/core/Game.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
212212
this.raf = null;
213213

214214
/**
215-
* @property {Phaser.GameObjects.Factory} add - Reference to the Phaser GameObject Factory.
215+
* @property {Phaser.GameObject.Factory} add - Reference to the Phaser GameObject Factory.
216216
*/
217217
this.add = null;
218218

@@ -614,7 +614,7 @@ Phaser.Game.prototype = {
614614

615615
this.world = new Phaser.World(this);
616616

617-
this.add = new Phaser.GameObjects.Factory(this);
617+
this.add = new Phaser.GameObject.Factory(this);
618618
this.add.boot();
619619

620620
this.make = new Phaser.GameObjectCreator(this);

src/core/Group.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
125125
* when a new object is created it is passed the following parameters to its constructor: `(game, x, y, key, frame)`.
126126
*
127127
* @property {object} classType
128-
* @default {@link Phaser.GameObjects.Sprite}
128+
* @default {@link Phaser.GameObject.Sprite}
129129
*/
130-
this.classType = Phaser.GameObjects.Sprite;
130+
this.classType = Phaser.GameObject.Sprite;
131131

132132
/**
133133
* The current display object that the group cursor is pointing to, if any. (Can be set manually.)

src/gameobjects/Factory.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
*
1111
* Created objects are _automatically added_ to the appropriate Manager, World, or manually specified parent Group.
1212
*
13-
* @class Phaser.GameObjects.Factory
13+
* @class Phaser.GameObject.Factory
1414
* @constructor
1515
* @param {Phaser.Game} game - A reference to the currently running game.
1616
*/
17-
Phaser.GameObjects.Factory = function (game) {
17+
Phaser.GameObject.Factory = function (game) {
1818

1919
/**
2020
* @property {Phaser.Game} game - A reference to the currently running Game.
@@ -30,29 +30,29 @@ Phaser.GameObjects.Factory = function (game) {
3030

3131
};
3232

33-
Phaser.GameObjects.Factory.prototype.constructor = Phaser.GameObjects.Factory;
33+
Phaser.GameObject.Factory.prototype.constructor = Phaser.GameObject.Factory;
3434

35-
Phaser.GameObjects.Factory.prototype = {
35+
Phaser.GameObject.Factory.prototype = {
3636

3737
boot: function ()
3838
{
39-
for (var gameobject in Phaser.GameObjects)
39+
for (var gameobject in Phaser.GameObject)
4040
{
41-
if (Phaser.GameObjects[gameobject].hasOwnProperty('FACTORY_KEY'))
41+
if (Phaser.GameObject[gameobject].hasOwnProperty('FACTORY_KEY'))
4242
{
43-
var key = Phaser.GameObjects[gameobject]['FACTORY_KEY'];
43+
var key = Phaser.GameObject[gameobject]['FACTORY_KEY'];
4444

4545
// console.log('found', key);
4646

47-
Phaser.GameObjects.Factory.prototype[key] = Phaser.GameObjects[gameobject]['FACTORY_ADD'];
47+
Phaser.GameObject.Factory.prototype[key] = Phaser.GameObject[gameobject]['FACTORY_ADD'];
4848
}
4949
}
5050
},
5151

5252
/**
5353
* Adds an existing display object to the game world.
5454
*
55-
* @method Phaser.GameObjects.Factory#existing
55+
* @method Phaser.GameObject.Factory#existing
5656
* @param {any} object - An instance of Phaser.Sprite, Phaser.Button or any other display object.
5757
* @return {any} The child that was added to the World.
5858
*/
@@ -67,7 +67,7 @@ Phaser.GameObjects.Factory.prototype = {
6767
*
6868
* The object can be any JavaScript object or Phaser object such as Sprite.
6969
*
70-
* @method Phaser.GameObjects.Factory#tween
70+
* @method Phaser.GameObject.Factory#tween
7171
* @param {object} object - Object the tween will be run on.
7272
* @return {Phaser.Tween} The newly created Phaser.Tween object.
7373
*/
@@ -80,7 +80,7 @@ Phaser.GameObjects.Factory.prototype = {
8080
/**
8181
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
8282
*
83-
* @method Phaser.GameObjects.Factory#group
83+
* @method Phaser.GameObject.Factory#group
8484
* @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
8585
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
8686
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
@@ -100,7 +100,7 @@ Phaser.GameObjects.Factory.prototype = {
100100
* A Physics Group is the same as an ordinary Group except that is has enableBody turned on by default, so any Sprites it creates
101101
* are automatically given a physics body.
102102
*
103-
* @method Phaser.GameObjects.Factory#physicsGroup
103+
* @method Phaser.GameObject.Factory#physicsGroup
104104
* @param {number} [physicsBodyType=Phaser.Physics.ARCADE] - If enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2JS, Phaser.Physics.NINJA, etc.
105105
* @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
106106
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
@@ -116,7 +116,7 @@ Phaser.GameObjects.Factory.prototype = {
116116
/**
117117
* Creates a new Sound object.
118118
*
119-
* @method Phaser.GameObjects.Factory#audio
119+
* @method Phaser.GameObject.Factory#audio
120120
* @param {string} key - The Game.cache key of the sound that this object will use.
121121
* @param {number} [volume=1] - The volume at which the sound will be played.
122122
* @param {boolean} [loop=false] - Whether or not the sound will loop.
@@ -132,7 +132,7 @@ Phaser.GameObjects.Factory.prototype = {
132132
/**
133133
* Creates a new Sound object.
134134
*
135-
* @method Phaser.GameObjects.Factory#sound
135+
* @method Phaser.GameObject.Factory#sound
136136
* @param {string} key - The Game.cache key of the sound that this object will use.
137137
* @param {number} [volume=1] - The volume at which the sound will be played.
138138
* @param {boolean} [loop=false] - Whether or not the sound will loop.
@@ -148,7 +148,7 @@ Phaser.GameObjects.Factory.prototype = {
148148
/**
149149
* Creates a new AudioSprite object.
150150
*
151-
* @method Phaser.GameObjects.Factory#audioSprite
151+
* @method Phaser.GameObject.Factory#audioSprite
152152
* @param {string} key - The Game.cache key of the sound that this object will use.
153153
* @return {Phaser.AudioSprite} The newly created AudioSprite object.
154154
*/
@@ -165,7 +165,7 @@ Phaser.GameObjects.Factory.prototype = {
165165
* continuous effects like rain and fire. All it really does is launch Particle objects out
166166
* at set intervals, and fixes their positions and velocities accordingly.
167167
*
168-
* @method Phaser.GameObjects.Factory#emitter
168+
* @method Phaser.GameObject.Factory#emitter
169169
* @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
170170
* @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
171171
* @param {number} [maxParticles=50] - The total number of particles in this emitter.
@@ -186,7 +186,7 @@ Phaser.GameObjects.Factory.prototype = {
186186
* If creating a blank tilemap to be populated later, you can either specify no parameters at all and then use `Tilemap.create` or pass the map and tile dimensions here.
187187
* Note that all Tilemaps use a base tile size to calculate dimensions from, but that a TilemapLayer may have its own unique tile size that overrides it.
188188
*
189-
* @method Phaser.GameObjects.Factory#tilemap
189+
* @method Phaser.GameObject.Factory#tilemap
190190
* @param {string} [key] - The key of the tilemap data as stored in the Cache. If you're creating a blank map either leave this parameter out or pass `null`.
191191
* @param {number} [tileWidth=32] - The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.
192192
* @param {number} [tileHeight=32] - The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.
@@ -202,7 +202,7 @@ Phaser.GameObjects.Factory.prototype = {
202202
/**
203203
* A dynamic initially blank canvas to which images can be drawn.
204204
*
205-
* @method Phaser.GameObjects.Factory#renderTexture
205+
* @method Phaser.GameObject.Factory#renderTexture
206206
* @param {number} [width=100] - the width of the RenderTexture.
207207
* @param {number} [height=100] - the height of the RenderTexture.
208208
* @param {string} [key=''] - Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).
@@ -230,7 +230,7 @@ Phaser.GameObjects.Factory.prototype = {
230230
*
231231
* A BitmapData object can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
232232
*
233-
* @method Phaser.GameObjects.Factory#bitmapData
233+
* @method Phaser.GameObject.Factory#bitmapData
234234
* @param {number} [width=256] - The width of the BitmapData in pixels.
235235
* @param {number} [height=256] - The height of the BitmapData in pixels.
236236
* @param {string} [key=''] - Asset key for the BitmapData when stored in the Cache (see addToCache parameter).
@@ -256,7 +256,7 @@ Phaser.GameObjects.Factory.prototype = {
256256
/**
257257
* A WebGL shader/filter that can be applied to Sprites.
258258
*
259-
* @method Phaser.GameObjects.Factory#filter
259+
* @method Phaser.GameObject.Factory#filter
260260
* @param {string} filter - The name of the filter you wish to create, for example HueRotate or SineWave.
261261
* @param {any} - Whatever parameters are needed to be passed to the filter init function.
262262
* @return {Phaser.Filter} The newly created Phaser.Filter object.
@@ -278,7 +278,7 @@ Phaser.GameObjects.Factory.prototype = {
278278
*
279279
* The Plugin must have 2 properties: `game` and `parent`. Plugin.game is set to the game reference the PluginManager uses, and parent is set to the PluginManager.
280280
*
281-
* @method Phaser.GameObjects.Factory#plugin
281+
* @method Phaser.GameObject.Factory#plugin
282282
* @param {object|Phaser.Plugin} plugin - The Plugin to add into the PluginManager. This can be a function or an existing object.
283283
* @param {...*} parameter - Additional parameters that will be passed to the Plugin.init method.
284284
* @return {Phaser.Plugin} The Plugin that was added to the manager.

0 commit comments

Comments
 (0)