2015-12-28 2 views
0

Это ниже упрощенная версия моего кода, где происходит меню. Я постоянно получаю эту error.It когда я сложилось, нажмите на кнопку воспроизведения:Uncaught TypeError: Невозможно прочитать свойство 'add' of null phaser

Uncaught TypeError: Cannot read property 'add' of null 

Я знаю то когда я проверить, если спрайт игра bieng щелкнул, но не могу понять проблему.

Вот картинка: enter image description here

JsFiddle Format

preload: function() { 
       game.load.image('background', 'http://s1.postimg.org/nqynk9tkv/starfield.png') 
       game.load.image('play-back', 'http://icon-park.com/imagefiles/movie_play_black.png'); 

      }, 
      create: function() { 
       this.backgroundImg = this.game.add.tileSprite(0, 0, 500, 550, 'background') 

       this.gameText = game.add.text(game.world.centerX-190, game.world.centerY - 150, "Space Invaders", { 
      font: "60px Times New Roman", 
      fill: "#ccccb3", 
      fontWeight: "bold", 
      stroke: "white", 
      strokeThickness: 2.5 
     }); 

/*  // this.gameText.anchor.setTo(0.5) 
     this.gameText.angle = 
*/ 
     play = game.add.sprite(120,280,'play-back') 
     play.scale.setTo(0.5); 
     game.physics.arcade.enable(play); 
     play.events.onInputDown.add(this.start, this); 

      }, 
      update: function() { 
       this.backgroundImg.tilePosition.y += 5; 


      }, 
      render: function() { 

      }, 
      start: function() { 

       game.start.main('main') 
      } 

     }; 
+0

любые anwsers .... –

ответ

Смежные вопросы