Почему не удаляется объект в массиве Phaser?
При щелчке на спрайте должно происходить удаление, однако ничего не происходит. При каждом щелчке в консоле выводит ошибку:
game.js:26 Uncaught TypeError: myGroup.clear is not a function Как сделать так, чтобы спрайт-картинка удалялась? Пример взят с оф. сайта, только слегка изменён. var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.image('mushroom', 'images/mushroom2.png'); } function create() { myGroup = game.add.group(); // This simply creates a sprite using the mushroom image we loaded above and positions it at 200 x 200 test = game.add.sprite(200, 200, 'mushroom'); test.inputEnabled = true; test.events.onInputDown.add(onClick, this); myGroup.add(test); } function onClick() { myGroup.clear(true,true); } |
Часовой пояс GMT +3, время: 15:09. |