Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create: function () {
- startBG = this.add.image(0, 0, 'titlescreen');
- startBG.inputEnabled = true;
- startBG.events.onInputDown.addOnce(this.startGame, this);
- console.log("startBG.input: " + startBG.input);
- console.log("startBG.input.keyboard: " + startBG.input.keyboard);
- startPrompt = this.add.bitmapText(this.world.centerX-155, this.world.centerY+180, 'eightbitwonder', 'Touch to Start!', 24);
- },
- startGame: function (pointer) {
- this.ding.play();
- this.state.start('Game');
- }
- Game.Preloader = function(game) {
- this.preloadBar = null;
- this.titleText = null;
- this.ready = false;
- };
- Game.Preloader.prototype = {
- preload: function () {
- this.preloadBar = this.add.sprite(this.world.centerX, this.world.centerY, 'preloaderBar');
- this.preloadBar.anchor.setTo(0.5, 0.5);
- this.load.setPreloadSprite(this.preloadBar);
- this.titleText = this.add.image(this.world.centerX, this.world.centerY-220, 'titleimage');
- this.titleText.anchor.setTo(0.5, 0.5);
- this.load.image('titlescreen', 'images/TitleBG.png');
- this.load.bitmapFont('eightbitwonder', 'fonts/eightbitwonder.png', 'fonts/eightbitwonder.fnt');
- this.load.image('hill', 'images/hill.png');
- this.load.image('sky', 'images/sky.png');
- this.load.atlasXML('bunny', 'images/spritesheets/bunny.png', 'images/spritesheets/bunny.xml');
- this.load.atlasXML('spacerock', 'images/spritesheets/SpaceRock.png', 'images/spritesheets/SpaceRock.xml');
- this.load.image('explosion', 'images/explosion.png');
- this.load.image('ghost', 'images/ghost.png');
- this.load.audio('explosion_audio', 'audio/explosion.mp3');
- this.load.audio('hurt_audio', 'audio/hurt.mp3');
- this.load.audio('select_audio', 'audio/select.mp3');
- this.load.audio('game_audio', 'audio/bgm.mp3');
- },
- create: function () {
- this.preloadBar.cropEnabled = false;
- },
- update: function () {
- if(this.cache.isSoundDecoded('game_audio') && this.ready == false) {
- this.ready = true;
- this.state.start('StartMenu');
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement