|
| 1 | +var __extends = this.__extends || function (d, b) { |
| 2 | + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; |
| 3 | + function __() { this.constructor = d; } |
| 4 | + __.prototype = b.prototype; |
| 5 | + d.prototype = new __(); |
| 6 | +}; |
| 7 | +/// <reference path="phaser.d.ts" /> |
| 8 | +var BasicGame; |
| 9 | +(function (BasicGame) { |
| 10 | + var Preloader = (function (_super) { |
| 11 | + __extends(Preloader, _super); |
| 12 | + function Preloader() { |
| 13 | + _super.apply(this, arguments); |
| 14 | + this.background = null; |
| 15 | + this.preloadBar = null; |
| 16 | + this.ready = false; |
| 17 | + } |
| 18 | + Preloader.prototype.preload = function () { |
| 19 | + this.background = this.add.sprite(0.0, 0.0, "preloaderBackground"); |
| 20 | + this.preloadBar = this.add.sprite(300, 400, "preloaderBar"); |
| 21 | + |
| 22 | + this.load.setPreloadSprite(this.preloadBar, 0); |
| 23 | + |
| 24 | + this.load.image("titlepage", "assets/title.jpg", false); |
| 25 | + this.load.image("playButton", "assets/play_button.png", false); |
| 26 | + this.load.audio("titleMusic", ["assets/main_menu.mp3", "assets/main_menu.ogg"], false); |
| 27 | + |
| 28 | + this.load.atlas("breakout", "assets/breakout.png", "assets/breakout.json"); |
| 29 | + this.load.image("starfield", "assets/starfield.jpg", false); |
| 30 | + }; |
| 31 | + |
| 32 | + Preloader.prototype.create = function () { |
| 33 | + this.preloadBar.cropEnabled = false; |
| 34 | + }; |
| 35 | + |
| 36 | + Preloader.prototype.update = function () { |
| 37 | + if (this.cache.isSoundDecoded("titleMusic") && this.ready == false) { |
| 38 | + this.ready = true; |
| 39 | + this.game.state.start("MainMenu"); |
| 40 | + } |
| 41 | + }; |
| 42 | + return Preloader; |
| 43 | + })(Phaser.State); |
| 44 | + BasicGame.Preloader = Preloader; |
| 45 | +})(BasicGame || (BasicGame = {})); |
0 commit comments