|
6 | 6 | /// <reference path="DynamicTexture.ts" /> |
7 | 7 | /// <reference path="FXManager.ts" /> |
8 | 8 | /// <reference path="GameMath.ts" /> |
| 9 | +/// <reference path="GameObjectFactory.ts" /> |
9 | 10 | /// <reference path="Group.ts" /> |
10 | 11 | /// <reference path="Loader.ts" /> |
11 | 12 | /// <reference path="Motion.ts" /> |
@@ -172,6 +173,12 @@ module Phaser { |
172 | 173 | */ |
173 | 174 | public onDestroyCallback = null; |
174 | 175 |
|
| 176 | + /** |
| 177 | + * Reference to the GameObject Factory. |
| 178 | + * @type {GameObjectFactory} |
| 179 | + */ |
| 180 | + public add: GameObjectFactory; |
| 181 | + |
175 | 182 | /** |
176 | 183 | * Reference to the assets cache. |
177 | 184 | * @type {Cache} |
@@ -251,7 +258,7 @@ module Phaser { |
251 | 258 | public rnd: RandomDataGenerator; |
252 | 259 |
|
253 | 260 | /** |
254 | | - * Device detector. |
| 261 | + * Contains device information and capabilities. |
255 | 262 | * @type {Device} |
256 | 263 | */ |
257 | 264 | public device: Device; |
@@ -292,6 +299,7 @@ module Phaser { |
292 | 299 | this.math = new GameMath(this); |
293 | 300 | this.stage = new Stage(this, parent, width, height); |
294 | 301 | this.world = new World(this, width, height); |
| 302 | + this.add = new GameObjectFactory(this); |
295 | 303 | this.sound = new SoundManager(this); |
296 | 304 | this.cache = new Cache(this); |
297 | 305 | this.collision = new Collision(this); |
@@ -619,125 +627,6 @@ module Phaser { |
619 | 627 |
|
620 | 628 | } |
621 | 629 |
|
622 | | - // Handy Proxy methods |
623 | | - |
624 | | - /** |
625 | | - * Create a new camera with specific position and size. |
626 | | - * |
627 | | - * @param x {number} X position of the new camera. |
628 | | - * @param y {number} Y position of the new camera. |
629 | | - * @param width {number} Width of the new camera. |
630 | | - * @param height {number} Height of the new camera. |
631 | | - * @returns {Camera} The newly created camera object. |
632 | | - */ |
633 | | - public createCamera(x: number, y: number, width: number, height: number): Camera { |
634 | | - return this.world.createCamera(x, y, width, height); |
635 | | - } |
636 | | - |
637 | | - /** |
638 | | - * Create a new GeomSprite with specific position. |
639 | | - * |
640 | | - * @param x {number} X position of the new geom sprite. |
641 | | - * @param y {number} Y position of the new geom sprite. |
642 | | - * @returns {GeomSprite} The newly created geom sprite object. |
643 | | - */ |
644 | | - public createGeomSprite(x: number, y: number): GeomSprite { |
645 | | - return this.world.createGeomSprite(x, y); |
646 | | - } |
647 | | - |
648 | | - /** |
649 | | - * Create a new Sprite with specific position and sprite sheet key. |
650 | | - * |
651 | | - * @param x {number} X position of the new sprite. |
652 | | - * @param y {number} Y position of the new sprite. |
653 | | - * @param key {string} Optional, key for the sprite sheet you want it to use. |
654 | | - * @returns {Sprite} The newly created sprite object. |
655 | | - */ |
656 | | - public createSprite(x: number, y: number, key?: string = ''): Sprite { |
657 | | - return this.world.createSprite(x, y, key); |
658 | | - } |
659 | | - |
660 | | - /** |
661 | | - * Create a new DynamicTexture with specific size. |
662 | | - * |
663 | | - * @param width {number} Width of the texture. |
664 | | - * @param height {number} Height of the texture. |
665 | | - * @returns {DynamicTexture} The newly created dynamic texture object. |
666 | | - */ |
667 | | - public createDynamicTexture(width: number, height: number): DynamicTexture { |
668 | | - return this.world.createDynamicTexture(width, height); |
669 | | - } |
670 | | - |
671 | | - /** |
672 | | - * Create a new object container. |
673 | | - * |
674 | | - * @param maxSize {number} Optional, capacity of this group. |
675 | | - * @returns {Group} The newly created group. |
676 | | - */ |
677 | | - public createGroup(maxSize?: number = 0): Group { |
678 | | - return this.world.createGroup(maxSize); |
679 | | - } |
680 | | - |
681 | | - /** |
682 | | - * Create a new Particle. |
683 | | - * |
684 | | - * @return {Particle} The newly created particle object. |
685 | | - */ |
686 | | - public createParticle(): Particle { |
687 | | - return this.world.createParticle(); |
688 | | - } |
689 | | - |
690 | | - /** |
691 | | - * Create a new Emitter. |
692 | | - * |
693 | | - * @param x {number} Optional, x position of the emitter. |
694 | | - * @param y {number} Optional, y position of the emitter. |
695 | | - * @param size {number} Optional, size of this emitter. |
696 | | - * @return {Emitter} The newly created emitter object. |
697 | | - */ |
698 | | - public createEmitter(x?: number = 0, y?: number = 0, size?: number = 0): Emitter { |
699 | | - return this.world.createEmitter(x, y, size); |
700 | | - } |
701 | | - |
702 | | - /** |
703 | | - * Create a new ScrollZone object with image key, position and size. |
704 | | - * |
705 | | - * @param key {string} Key to a image you wish this object to use. |
706 | | - * @param x {number} X position of this object. |
707 | | - * @param y {number} Y position of this object. |
708 | | - * @param width number} Width of this object. |
709 | | - * @param height {number} Height of this object. |
710 | | - * @returns {ScrollZone} The newly created scroll zone object. |
711 | | - */ |
712 | | - public createScrollZone(key: string, x?: number = 0, y?: number = 0, width?: number = 0, height?: number = 0): ScrollZone { |
713 | | - return this.world.createScrollZone(key, x, y, width, height); |
714 | | - } |
715 | | - |
716 | | - /** |
717 | | - * Create a new Tilemap. |
718 | | - * |
719 | | - * @param key {string} Key for tileset image. |
720 | | - * @param mapData {string} Data of this tilemap. |
721 | | - * @param format {number} Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON) |
722 | | - * @param [resizeWorld] {boolean} resize the world to make same as tilemap? |
723 | | - * @param [tileWidth] {number} width of each tile. |
724 | | - * @param [tileHeight] {number} height of each tile. |
725 | | - * @return {Tilemap} The newly created tilemap object. |
726 | | - */ |
727 | | - public createTilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0): Tilemap { |
728 | | - return this.world.createTilemap(key, mapData, format, resizeWorld, tileWidth, tileHeight); |
729 | | - } |
730 | | - |
731 | | - /** |
732 | | - * Create a tween object for a specific object. |
733 | | - * |
734 | | - * @param obj Object you wish the tween will affect. |
735 | | - * @return {Phaser.Tween} The newly created tween object. |
736 | | - */ |
737 | | - public createTween(obj): Tween { |
738 | | - return this.tweens.create(obj); |
739 | | - } |
740 | | - |
741 | 630 | /** |
742 | 631 | * Checks for overlaps between two objects using the world QuadTree. Can be GameObject vs. GameObject, GameObject vs. Group or Group vs. Group. |
743 | 632 | * Note: Does not take the objects scrollFactor into account. All overlaps are check in world space. |
|
0 commit comments