Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. create: function () {
  2. startBG = this.add.image(0, 0, 'titlescreen');
  3. startBG.inputEnabled = true;
  4. startBG.events.onInputDown.addOnce(this.startGame, this);
  5.  
  6. console.log("startBG.input: " + startBG.input);
  7. console.log("startBG.input.keyboard: " + startBG.input.keyboard);
  8.  
  9. startPrompt = this.add.bitmapText(this.world.centerX-155, this.world.centerY+180, 'eightbitwonder', 'Touch to Start!', 24);
  10. },
  11.  
  12. startGame: function (pointer) {
  13. this.ding.play();
  14. this.state.start('Game');
  15. }
  16.  
  17. Game.Preloader = function(game) {
  18. this.preloadBar = null;
  19. this.titleText = null;
  20. this.ready = false;
  21. };
  22.  
  23. Game.Preloader.prototype = {
  24.  
  25. preload: function () {
  26. this.preloadBar = this.add.sprite(this.world.centerX, this.world.centerY, 'preloaderBar');
  27. this.preloadBar.anchor.setTo(0.5, 0.5);
  28. this.load.setPreloadSprite(this.preloadBar);
  29. this.titleText = this.add.image(this.world.centerX, this.world.centerY-220, 'titleimage');
  30. this.titleText.anchor.setTo(0.5, 0.5);
  31. this.load.image('titlescreen', 'images/TitleBG.png');
  32. this.load.bitmapFont('eightbitwonder', 'fonts/eightbitwonder.png', 'fonts/eightbitwonder.fnt');
  33. this.load.image('hill', 'images/hill.png');
  34. this.load.image('sky', 'images/sky.png');
  35. this.load.atlasXML('bunny', 'images/spritesheets/bunny.png', 'images/spritesheets/bunny.xml');
  36. this.load.atlasXML('spacerock', 'images/spritesheets/SpaceRock.png', 'images/spritesheets/SpaceRock.xml');
  37. this.load.image('explosion', 'images/explosion.png');
  38. this.load.image('ghost', 'images/ghost.png');
  39. this.load.audio('explosion_audio', 'audio/explosion.mp3');
  40. this.load.audio('hurt_audio', 'audio/hurt.mp3');
  41. this.load.audio('select_audio', 'audio/select.mp3');
  42. this.load.audio('game_audio', 'audio/bgm.mp3');
  43. },
  44.  
  45. create: function () {
  46. this.preloadBar.cropEnabled = false;
  47. },
  48.  
  49. update: function () {
  50. if(this.cache.isSoundDecoded('game_audio') && this.ready == false) {
  51. this.ready = true;
  52. this.state.start('StartMenu');
  53. }
  54. }
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement