JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://github.com/photonstorm/phaser/releases/download/v2.4.4/phaser.min.js"></script>
JavaScript
// Initialize Phaser, and creates a 400x490px game
var game = new Phaser.Game(400, 490, Phaser.CANVAS, 'game_div');
// -- FriarDude
Blah = {}
Blah.CustomGroup = function (game) {
console.log("Blah.CustomGroup::")
// Constructor
Phaser.Group.call(this, game);
game.add.existing(this)
}
Blah.CustomGroup.prototype = Object.create(Phaser.Group.prototype);
Blah.CustomGroup.prototype.constructor = Blah.CustomGroup;
Blah.CustomGroup.prototype.create = function(x,y,key, frame, exists) {
// call group create
Phaser.Group.prototype.create.call(this, x, y, key, frame, exists)
console.log('Blah.CustomGroup : create');
//this.setLevelID(this.levelID);
//
}
// Game
var Test = Test || {};
Test.Game = function () {
};
Test.Game.prototype = {
preload: function() {
console.log("Test game : preload");
game.load.image('car', 'http://s3.amazonaws.com/uploads-1969f46zwpmbh5cm3kr2/hello.png');
},
create: function () {
console.log("Test game : create");
var bcg = new Blah.CustomGroup(game)
bcg.create(100,100,'car')
}
}
//
game.state.add('main', Test.Game);
game.state.start('main');