diff --git a/wip/TS Tests/template_breakout/Boot.js b/wip/TS Tests/template_breakout/Boot.js
index ae382cb3a..722d05c09 100644
--- a/wip/TS Tests/template_breakout/Boot.js
+++ b/wip/TS Tests/template_breakout/Boot.js
@@ -13,11 +13,12 @@ var BasicGame;
_super.apply(this, arguments);
}
Boot.prototype.preload = function () {
- this.load.image("preloaderBackground", "assets/preloader_background.gif", false);
- this.load.image("preloaderBar", "assets/preloadr_bar.png", false);
+ this.load.image("preloaderBackground", "assets/preloader_background.gif");
+ this.load.image("preloaderBar", "assets/preloadr_bar.png");
};
Boot.prototype.create = function () {
this.game.input.maxPointers = 1;
+ this.game.stage.disableVisibilityChange = true;
if (this.game.device.desktop) {
this.game.stage.scale.pageAlignHorizontally = true;
diff --git a/wip/TS Tests/template_breakout/Boot.ts b/wip/TS Tests/template_breakout/Boot.ts
index bfd1d033e..2a08d88b9 100644
--- a/wip/TS Tests/template_breakout/Boot.ts
+++ b/wip/TS Tests/template_breakout/Boot.ts
@@ -3,12 +3,12 @@ module BasicGame
{
export class Boot extends Phaser.State{
preload() {
- this.load.image("preloaderBackground","assets/preloader_background.gif",false);
- this.load.image("preloaderBar","assets/preloadr_bar.png",false);
+ this.load.image("preloaderBackground","assets/preloader_background.gif");
+ this.load.image("preloaderBar","assets/preloadr_bar.png");
}
create() {
this.game.input.maxPointers = 1;
- //this.game.stage. disableVisibilityChange is missing
+ this.game.stage.disableVisibilityChange = true;
if( this.game.device.desktop )
{
diff --git a/wip/TS Tests/template_breakout/Main.js b/wip/TS Tests/template_breakout/Main.js
index 2b1864404..9a36a21ea 100644
--- a/wip/TS Tests/template_breakout/Main.js
+++ b/wip/TS Tests/template_breakout/Main.js
@@ -2,12 +2,14 @@
///
///
///
+///
window.onload = function () {
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameContainer', null, false, false);
- game.state.add("Boot", BasicGame.Boot, false);
- game.state.add("Preloader", BasicGame.Preloader, false);
- game.state.add("MainMenu", BasicGame.MainMenu, false);
+ game.state.add("Boot", BasicGame.Boot);
+ game.state.add("Preloader", BasicGame.Preloader);
+ game.state.add("MainMenu", BasicGame.MainMenu);
+ game.state.add("GameState", BasicGame.GameState);
game.state.start("Boot");
};
diff --git a/wip/TS Tests/template_breakout/Main.ts b/wip/TS Tests/template_breakout/Main.ts
index fed8fcb54..a233bd0ed 100644
--- a/wip/TS Tests/template_breakout/Main.ts
+++ b/wip/TS Tests/template_breakout/Main.ts
@@ -2,13 +2,15 @@
///
///
///
+///
window.onload = function() {
var game:Phaser.Game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameContainer', null, false, false);
- game.state.add("Boot", BasicGame.Boot, false);
- game.state.add("Preloader", BasicGame.Preloader, false);
- game.state.add("MainMenu", BasicGame.MainMenu, false );
+ game.state.add("Boot", BasicGame.Boot);
+ game.state.add("Preloader", BasicGame.Preloader);
+ game.state.add("MainMenu", BasicGame.MainMenu);
+ game.state.add("GameState", BasicGame.GameState );
game.state.start("Boot");
}
diff --git a/wip/TS Tests/template_breakout/MainMenu.js b/wip/TS Tests/template_breakout/MainMenu.js
index f3ea76339..b130091bc 100644
--- a/wip/TS Tests/template_breakout/MainMenu.js
+++ b/wip/TS Tests/template_breakout/MainMenu.js
@@ -13,17 +13,17 @@ var BasicGame;
_super.apply(this, arguments);
}
MainMenu.prototype.create = function () {
- this.music = this.add.audio("titleMusic", 1, false);
- this.music.play("titleMusic", 0);
+ this.music = this.add.audio("titleMusic");
+ this.music.play();
this.add.sprite(0, 0, "titlepage");
- this.playButton = this.add.button(200, 300, "playButton", this.startGame, 1, 1, 1);
+ this.playButton = this.add.button(200, 300, "playButton", this.startGame, this);
};
MainMenu.prototype.startGame = function () {
this.music.stop();
- alert("START THE GAME!");
+ this.game.state.start("GameState");
};
return MainMenu;
})(Phaser.State);
diff --git a/wip/TS Tests/template_breakout/MainMenu.ts b/wip/TS Tests/template_breakout/MainMenu.ts
index ceab2a0ab..4103b4855 100644
--- a/wip/TS Tests/template_breakout/MainMenu.ts
+++ b/wip/TS Tests/template_breakout/MainMenu.ts
@@ -2,24 +2,23 @@
module BasicGame
{
- export class MainMenu extends Phaser.State
- {
+ export class MainMenu extends Phaser.State{
music:Phaser.Sound;
playButton:Phaser.Button;
create():void {
- this.music = this.add.audio("titleMusic",1,false);
- this.music.play("titleMusic",0);
+ this.music = this.add.audio("titleMusic");
+ this.music.play();
this.add.sprite(0,0,"titlepage");
- this.playButton = this.add.button(200,300,"playButton", this.startGame, 1, 1, 1);
+ this.playButton = this.add.button(200,300,"playButton", this.startGame, this);
}
startGame():void {
this.music.stop();
- alert("START THE GAME!");
+ this.game.state.start("GameState");
}
}
}
\ No newline at end of file
diff --git a/wip/TS Tests/template_breakout/Preloader.js b/wip/TS Tests/template_breakout/Preloader.js
index fa6786498..1754a64de 100644
--- a/wip/TS Tests/template_breakout/Preloader.js
+++ b/wip/TS Tests/template_breakout/Preloader.js
@@ -19,14 +19,14 @@ var BasicGame;
this.background = this.add.sprite(0.0, 0.0, "preloaderBackground");
this.preloadBar = this.add.sprite(300, 400, "preloaderBar");
- this.load.setPreloadSprite(this.preloadBar, 0);
+ this.load.setPreloadSprite(this.preloadBar);
- this.load.image("titlepage", "assets/title.jpg", false);
- this.load.image("playButton", "assets/play_button.png", false);
- this.load.audio("titleMusic", ["assets/main_menu.mp3", "assets/main_menu.ogg"], false);
+ this.load.image("titlepage", "assets/title.gif");
+ this.load.image("playButton", "assets/play_button.png");
+ this.load.audio("titleMusic", ["assets/main_menu.mp3", "assets/main_menu.ogg"]);
this.load.atlas("breakout", "assets/breakout.png", "assets/breakout.json");
- this.load.image("starfield", "assets/starfield.jpg", false);
+ this.load.image("starfield", "assets/starfield.jpg");
};
Preloader.prototype.create = function () {
diff --git a/wip/TS Tests/template_breakout/Preloader.ts b/wip/TS Tests/template_breakout/Preloader.ts
index b81f96313..376b1f590 100644
--- a/wip/TS Tests/template_breakout/Preloader.ts
+++ b/wip/TS Tests/template_breakout/Preloader.ts
@@ -10,14 +10,14 @@ module BasicGame
this.background = this.add.sprite(0.0,0.0,"preloaderBackground");
this.preloadBar = this.add.sprite(300,400,"preloaderBar");
- this.load.setPreloadSprite( this.preloadBar, 0 );
+ this.load.setPreloadSprite( this.preloadBar );
- this.load.image("titlepage","assets/title.jpg",false);
- this.load.image("playButton","assets/play_button.png",false);
- this.load.audio("titleMusic",["assets/main_menu.mp3","assets/main_menu.ogg"],false);
+ this.load.image("titlepage","assets/title.gif");
+ this.load.image("playButton","assets/play_button.png");
+ this.load.audio("titleMusic",["assets/main_menu.mp3","assets/main_menu.ogg"]);
this.load.atlas("breakout","assets/breakout.png","assets/breakout.json");
- this.load.image("starfield","assets/starfield.jpg",false);
+ this.load.image("starfield","assets/starfield.jpg");
}
create():void {
diff --git a/wip/TS Tests/template_breakout/phaser.d.ts b/wip/TS Tests/template_breakout/phaser.d.ts
index 6f1b33283..43e150c0d 100644
--- a/wip/TS Tests/template_breakout/phaser.d.ts
+++ b/wip/TS Tests/template_breakout/phaser.d.ts
@@ -87,7 +87,7 @@ declare module Phaser {
onPausedCallback(): void;
onShutDownCallback(): void;
boot(): void;
- add(key: string, state: typeof Phaser.State, autoStart: boolean): void;
+ add(key: string, state: typeof Phaser.State, autoStart?: boolean): void;
remove(key: string): void;
start(key: string, clearWorld?: boolean, clearCache?: boolean): void;
dummy(): void;
@@ -120,10 +120,10 @@ declare module Phaser {
memorize: boolean;
active: boolean;
validateListener(listener: Function, fnName: string): void;
- has(listener: Function, context?: Object): boolean;
- add(listener: Function, listenerContext?: Object, priority?: number): Phaser.SignalBinding;
- addOnce(listener: Function, listenerContext?: Object, priority?: number): Phaser.SignalBinding;
- remove(listener: Function, context?: Object): Function;
+ has(listener: Function, context?: any): boolean;
+ add(listener: Function, listenerContext?: any, priority?: number): Phaser.SignalBinding;
+ addOnce(listener: Function, listenerContext?: any, priority?: number): Phaser.SignalBinding;
+ remove(listener: Function, context?: any): Function;
removeAll(): void;
getNumListeners(): number;
halt(): void;
@@ -185,6 +185,7 @@ declare module Phaser {
scale: Phaser.StageScaleMode;
aspectRatio: number;
backgroundColor: string;
+ disableVisibilityChange: boolean;
boot(): void;
visibilityChange(event: Event): void;
}
@@ -205,7 +206,7 @@ declare module Phaser {
add(child: any): any;
addAt(child: any, index: number): any;
getAt(index: number): any;
- create(x: number, y: number, key: string, frame: string, exists: boolean): any;
+ create(x: number, y: number, key: string, frame: string, exists?: boolean): any;
swap(child1: any, child2: any): boolean;
bringToTop(child: any): any;
getIndex(child: any): number;
@@ -216,7 +217,7 @@ declare module Phaser {
multiplyAll(key: string, value: number, checkAlive: boolean, checkVisible: boolean, operation: number): void;
divideAll(key: string, value: number, checkAlive: boolean, checkVisible: boolean, operation: number): void;
callAllExists(callback: Function, callbackContext: Object, existsValue: boolean): void;
- callAll(callback: Function, callbackContext: Object): void;
+ callAll(callback: string, callbackContext?: Object): void;
forEach(callback: Function, callbackContext: Object, checkExists: boolean): void;
forEachAlive(callback: Function, callbackContext: Object): void;
forEachDead(callback: Function, callbackContext: Object): void;
@@ -343,10 +344,10 @@ declare module Phaser {
touch: Phaser.Touch;
mspointer: Phaser.MSPointer;
interactiveItems: Phaser.LinkedList;
- onDown(): void;
- onUp(): void;
- onTap(): void;
- onHold(): void;
+ onDown: Phaser.Signal;
+ onUp: Phaser.Signal;
+ onTap: Phaser.Signal;
+ onHold: Phaser.Signal;
boot(): void;
update(): void;
reset(hard?: boolean);
@@ -655,14 +656,14 @@ declare module Phaser {
game: Phaser.Game;
world: Phaser.World;
existing(object: any): boolean;
- sprite(x: number, y: number, key?: string, frame?: number): Phaser.Sprite;
+ sprite(x: number, y: number, key?: string, frame?: any): Phaser.Sprite;
child(parent: any, x: number, y: number, key?: string, frame?: number): Phaser.Sprite;
tween(obj: Object): Phaser.Tween;
- group(parent: any, name: string): Phaser.Group;
- audio(key: string, volume: number, loop: boolean): Phaser.Sound;
+ group(parent?: any, name?: string): Phaser.Group;
+ audio(key: string, volume?: number, loop?: boolean): Phaser.Sound;
tileSprite(x: number, y: number, width: number, height: number, key?: string, frame?: number): Phaser.TileSprite;
- text(x: number, y: number, text: string, style: string): Phaser.Text;
- button(x: number, y: number, key: string, callback: Function, callbackContext: Object, overFrame?: number, outFrame?: number, downFrame?: number): Phaser.Button;
+ text(x: number, y: number, text: string, style: any): Phaser.Text;
+ button(x: number, y: number, key: string, callback: Function, callbackContext: Object, overFrame?: any, outFrame?: any, downFrame?: any): Phaser.Button;
graphics(x: number, y: number): Phaser.Graphics;
emitter(x: number, y: number, maxParticles: number): Phaser.Particles.Arcade.Emitter;
bitmapText(x: number, y: number, text: string, style: string): Phaser.BitmapText;
@@ -737,12 +738,14 @@ declare module Phaser {
exists: boolean;
alive: boolean;
group: Phaser.Group;
+ content: string;
name: string;
game: Phaser.Game;
type: number;
text: string;
angle: number;
style: string;
+ visible: boolean;
position: Phaser.Point;
anchor: Phaser.Point;
scale: Phaser.Point;
@@ -755,7 +758,7 @@ declare module Phaser {
}
class Button {
- constructor(game: Phaser.Game, x: number, y: number, key: string, callback: typeof Function, overFrame: number, outFrame: number, downFrame: number);
+ constructor(game: Phaser.Game, x: number, y: number, key: string, callback: Function, overFrame: number, outFrame: number, downFrame: number);
input: Phaser.InputHandler;
onInputUp: Phaser.Signal;
onInputDown: Phaser.Signal;
@@ -1383,7 +1386,7 @@ declare module Phaser {
onFileError: Phaser.Signal;
onLoadStart: Phaser.Signal;
onLoadComplete: Phaser.Signal;
- setPreloadSprite(sprite: Phaser.Sprite, direction: number): void;
+ setPreloadSprite(sprite: Phaser.Sprite, direction?: number): void;
checkKeyExists(key: string): boolean;
reset(): void;
addToFileList(type: string, key: string, url: string, properties: Array): void;
@@ -1454,7 +1457,7 @@ declare module Phaser {
addMarker(name: string, start: number, stop: number, volume?: number, loop?: boolean): void;
removeMarker(name: string): void;
update(): void;
- play(marker: string, position: number, volume?: number, loop?: boolean): Phaser.Sound;
+ play(marker?: string, position?: number, volume?: number, loop?: boolean): Phaser.Sound;
restart(marker: string, position: number, volume?: number, loop?: boolean): void;
pause(): void;
resume(): void;