lokhmakov

Untitled

May 25th, 2014
688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. /// <reference path='../bower_components/phaser-official/build/phaser.d.ts' />
  2. /// <reference path='game.ts' />
  3.  
  4. module SlashSystem {
  5. export class Preloader extends Phaser.State {
  6. preloadBar: Phaser.Sprite;
  7.  
  8. WebFontConfig: any;
  9.  
  10. preload() {
  11. this.game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js', () => {
  12. }, this);
  13.  
  14. /*this.preloadBar = this.add.sprite(this.game.width/2, this.game.height/2, 'preloader');
  15. this.preloadBar.x -= this.preloadBar.width/2;
  16. this.preloadBar.y -= this.preloadBar.height/2;
  17. this.load.setPreloadSprite(this.preloadBar);*/
  18.  
  19. this.load.image('bg', 'assets/back5.jpg');
  20. this.load.image('bg2', 'assets/bg.jpg');
  21. }
  22.  
  23. create() {
  24. /*var tween = this.add.tween(this.preloadBar).to({ alpha: 0 }, 1000, Phaser.Easing.Linear.None, true);
  25. tween.onComplete.add(this.startSector, this);*/
  26.  
  27. var o = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'splash');
  28.  
  29. var iLow = this.game.width*0.8 / o.width;
  30. o.width *= iLow;
  31. o.height *= iLow;
  32.  
  33. o.anchor.setTo(0.5, 0.5);
  34. o.alpha = 0;
  35.  
  36. var tween = this.game.add.tween(o).to( { alpha: 1 }, 1000, Phaser.Easing.Linear.None, true, 0, 1, true);
  37. tween.onComplete.add(this.startSector, this);
  38. }
  39.  
  40. startSector() {
  41. var o: SlashSystem.Game = <SlashSystem.Game> this.game;
  42. while (!o.bFontsReady) {}
  43. this.game.state.start('sector', true, false);
  44. }
  45.  
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment