Добавление группы кнопок для воспроизведения звука.Фазер 2 - PullRequest
0 голосов
/ 09 февраля 2019

Я пишу свою первую игру на Phaser 2. Возникла проблема с добавлением кнопок, которые должны воспроизводить озвучку из заголовка аудио.Вот код для добавления:

fx = this.game.add.audio('sound1');
    fx.allowMultiple = true;

    fx.addMarker('app', 1, 1.0);
    fx.addMarker('le', 3, 0.5);
    makeButton('app', 550, 100);
    makeButton('le', 550, 140);

function makeButton(name, x, y) {

    var buttons = this.game.make.button(x, y, 'sound11', click, this, 2, 1, 0);
    buttons.name = name;
   buttons.scale.set(2, 1.5);
   buttons.smoothed = false;
}
function click(buttons) {

    fx.play(buttons.name);

}

Выдает следующую ошибку :

Uncaught TypeError: Невозможно прочитать свойство make из undefined в makeButton (Main.js: 150) -> var buttons = this.game.make.button (x, y, 'sound11', щелкните, this, 2, 1, 0);в Game.Main.create (Main.js: 142) -> makeButton ('app', 550, 100);

...