JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.1/phaser.min.js"></script>

JavaScript

sprite = function(game,im,g,posx,posy){
this.g=g
this.g=game.add.group()
this.posx=posx
this.posy=posy
Phaser.Sprite.call(this,game,this.posx+0,this.posy,im)
this.buttons=[]
for (var i=0;i < 5;i++){
this.buttons[i]=game.add.button(this.posx,this.posy+i*50,im,(but) => this.action(but.id),this)
this.buttons[i].id=i
this.g.add(this.buttons[i])
}
this.g.add(this)
}

sprite.prototype = Object.create(Phaser.Sprite.prototype)
sprite.prototype.constructor = sprite

sprite.prototype.action=function(n){
console.log(n)
}
////////////////////////////////////////////////////////

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
var g1
function preload() {
}

function create() {
var Sprite = new sprite(game,'ico',g1,0,0)
}