Updating for TypeScript 0.9.1, part 1.

This commit is contained in:
Richard Davey
2013-08-08 11:34:33 +01:00
parent 73745e5720
commit df32190db8
86 changed files with 583 additions and 587 deletions
+9 -9
View File
@@ -76,7 +76,7 @@ module Phaser {
* @param [downFrame] {string|number} This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
* @returns {Button} The newly created button object.
*/
public button(x?: number = 0, y?: number = 0, key?: string = null, callback? = null, callbackContext? = null, overFrame? = null, outFrame? = null, downFrame? = null): UI.Button {
public button(x: number = 0, y: number = 0, key: string = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null): UI.Button {
return <UI.Button> this._world.group.add(new UI.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
}
@@ -89,11 +89,11 @@ module Phaser {
* @param [frame] {string|number} If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
* @returns {Sprite} The newly created sprite object.
*/
public sprite(x: number, y: number, key?: string = '', frame? = null): Sprite {
public sprite(x: number, y: number, key: string = '', frame = null): Sprite {
return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame));
}
public audio(key: string, volume?: number = 1, loop?: bool = false) {
public audio(key: string, volume: number = 1, loop: boolean = false) {
return <Sound> this.game.sound.add(key, volume, loop);
}
@@ -108,7 +108,7 @@ module Phaser {
* @param [shapeType] The default body shape is either 0 for a Box or 1 for a Circle. See Sprite.body.addShape for custom shapes (polygons, etc)
* @returns {Sprite} The newly created sprite object.
*/
//public physicsSprite(x: number, y: number, key?: string = '', frame? = null, bodyType?: number = Phaser.Types.BODY_DYNAMIC, shapeType?:number = 0): Sprite {
//public physicsSprite(x: number, y: number, key: string = '', frame? = null, bodyType: number = Phaser.Types.BODY_DYNAMIC, shapeType:number = 0): Sprite {
// return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame, bodyType, shapeType));
//}
@@ -129,7 +129,7 @@ module Phaser {
* @param maxSize {number} Optional, capacity of this group.
* @returns {Group} The newly created group.
*/
public group(maxSize?: number = 0): Group {
public group(maxSize: number = 0): Group {
return <Group> this._world.group.add(new Group(this.game, maxSize));
}
@@ -150,7 +150,7 @@ module Phaser {
* @param size {number} Optional, size of this emitter.
* @return {Emitter} The newly created emitter object.
*/
public emitter(x?: number = 0, y?: number = 0, size?: number = 0): ArcadeEmitter {
public emitter(x: number = 0, y: number = 0, size: number = 0): ArcadeEmitter {
return <ArcadeEmitter> this._world.group.add(new ArcadeEmitter(this.game, x, y, size));
}
@@ -164,7 +164,7 @@ module Phaser {
* @param height {number} Height of this object.
* @returns {ScrollZone} The newly created scroll zone object.
*/
public scrollZone(key: string, x?: number = 0, y?: number = 0, width?: number = 0, height?: number = 0): ScrollZone {
public scrollZone(key: string, x: number = 0, y: number = 0, width: number = 0, height: number = 0): ScrollZone {
return <ScrollZone> this._world.group.add(new ScrollZone(this.game, key, x, y, width, height));
}
@@ -179,7 +179,7 @@ module Phaser {
* @param [tileHeight] {number} height of each tile.
* @return {Tilemap} The newly created tilemap object.
*/
public tilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0): Tilemap {
public tilemap(key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0): Tilemap {
return <Tilemap> this._world.group.add(new Tilemap(this.game, key, mapData, format, resizeWorld, tileWidth, tileHeight));
}
@@ -190,7 +190,7 @@ module Phaser {
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
* @return {Phaser.Tween} The newly created tween object.
*/
public tween(obj, localReference?:bool = false): Tween {
public tween(obj, localReference:boolean = false): Tween {
return this.game.tweens.create(obj, localReference);
}
+3 -3
View File
@@ -42,17 +42,17 @@ module Phaser {
/**
* Controls if both <code>update</code> and render are called by the core game loop.
*/
exists: bool;
exists: boolean;
/**
* Controls if <code>update()</code> is automatically called by the core game loop.
*/
active: bool;
active: boolean;
/**
* Controls if this is rendered or skipped during the core game loop.
*/
visible: bool;
visible: boolean;
/**
* The animation manager component
+1 -1
View File
@@ -54,7 +54,7 @@ module Phaser {
* Will this region be rendered? (default to true)
* @type {boolean}
*/
public visible: bool = true;
public visible: boolean = true;
/**
* Region scrolling speed.
+2 -2
View File
@@ -26,7 +26,7 @@ module Phaser {
* @param [width] {number} width of this object.
* @param [height] {number} height of this object.
*/
constructor(game: Game, key:string, x: number = 0, y: number = 0, width?: number = 0, height?: number = 0) {
constructor(game: Game, key:string, x: number = 0, y: number = 0, width: number = 0, height: number = 0) {
super(game, x, y, key);
@@ -80,7 +80,7 @@ module Phaser {
* @param [speedY] {number} y-axis scrolling speed.
* @return {ScrollRegion} The newly added region.
*/
public addRegion(x: number, y: number, width: number, height: number, speedX?:number = 0, speedY?:number = 0):ScrollRegion {
public addRegion(x: number, y: number, width: number, height: number, speedX:number = 0, speedY:number = 0):ScrollRegion {
if (x > this.width || y > this.height || x < 0 || y < 0 || (x + width) > this.width || (y + height) > this.height)
{
+8 -8
View File
@@ -24,7 +24,7 @@ module Phaser {
* @param [y] {number} the initial y position of the sprite.
* @param [key] {string} Key of the graphic you want to load for this sprite.
*/
constructor(game: Game, x?: number = 0, y?: number = 0, key?: string = null, frame? = null) {
constructor(game: Game, x: number = 0, y: number = 0, key: string = null, frame = null) {
this.game = game;
this.type = Phaser.Types.SPRITE;
@@ -106,27 +106,27 @@ module Phaser {
/**
* Controls if both <code>update</code> and render are called by the core game loop.
*/
public exists: bool;
public exists: boolean;
/**
* Controls if <code>update()</code> is automatically called by the core game loop.
*/
public active: bool;
public active: boolean;
/**
* Controls if this Sprite is rendered or skipped during the core game loop.
*/
public visible: bool;
public visible: boolean;
/**
* A useful state for many game objects. Kill and revive both flip this switch.
*/
public alive: bool;
public alive: boolean;
/**
* Is the Sprite out of the world bounds or not?
*/
public outOfBounds: bool;
public outOfBounds: boolean;
/**
* The action to be taken when the sprite is fully out of the world bounds
@@ -185,7 +185,7 @@ module Phaser {
/**
* A boolean representing if the Sprite has been modified in any way via a scale, rotate, flip or skew.
*/
public modified: bool = false;
public modified: boolean = false;
/**
* x value of the object.
@@ -419,7 +419,7 @@ module Phaser {
* like to animate an effect or whatever, you should override this,
* setting only alive to false, and leaving exists true.
*/
public kill(removeFromGroup:bool = false) {
public kill(removeFromGroup:boolean = false) {
this.alive = false;
this.exists = false;
+1 -1
View File
@@ -45,7 +45,7 @@ module Phaser.Components {
private _rotation: number;
private _dirty: bool = false;
private _dirty: boolean = false;
// Cache vars
private _pos: Phaser.Point;