JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.1/phaser.min.js"></script>
JavaScript
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:preload, create: create });
function preload() {
game.load.image('circle', 'https://s13.postimg.org/xjhlzmiev/disc_png.png');
game.load.image('rect', 'http://s10.postimg.org/6fa6mgrd5/motif.jpg');
}
//E for external module
var E = E || {}
//var sprite={}
var circle={}
MonsterGroup = function (game, image,image2) {
Phaser.Group.call(this, game);
this.sprite=[]
for (var i = 0; i < 5; i++)
{
this.sprite[i] = this.create(100+i, game.world.randomY, image);
this.sprite[i].scale.setTo(.2,.2)
circle[i] = this.create(game.world.randomX, game.world.randomY, image2);
}
//return sprite
};
MonsterGroup.prototype = Object.create(Phaser.Group.prototype);
MonsterGroup.prototype.constructor = MonsterGroup;
E=E || {}
function create() {
customGroup1 = new MonsterGroup(game, 'rect','circle');
customGroup1.alpha=1
customGroup1.sprite[1].alpha =.2
}