Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <reference path='../bower_components/phaser-official/build/phaser.d.ts' />
- /// <reference path='game.ts' />
- module SlashSystem {
- export class Preloader extends Phaser.State {
- preloadBar: Phaser.Sprite;
- WebFontConfig: any;
- preload() {
- this.game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js', () => {
- }, this);
- /*this.preloadBar = this.add.sprite(this.game.width/2, this.game.height/2, 'preloader');
- this.preloadBar.x -= this.preloadBar.width/2;
- this.preloadBar.y -= this.preloadBar.height/2;
- this.load.setPreloadSprite(this.preloadBar);*/
- this.load.image('bg', 'assets/back5.jpg');
- this.load.image('bg2', 'assets/bg.jpg');
- }
- create() {
- /*var tween = this.add.tween(this.preloadBar).to({ alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
- tween.onComplete.add(this.startSector, this);*/
- var o = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'splash');
- var iLow = this.game.width*0.8 / o.width;
- o.width *= iLow;
- o.height *= iLow;
- o.anchor.setTo(0.5, 0.5);
- o.alpha = 0;
- var tween = this.game.add.tween(o).to( { alpha: 1 }, 1000, Phaser.Easing.Linear.None, true, 0, 1, true);
- tween.onComplete.add(this.startSector, this);
- }
- startSector() {
- var o: SlashSystem.Game = <SlashSystem.Game> this.game;
- while (!o.bFontsReady) {}
- this.game.state.start('sector', true, false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment