JSFiddle - React, Tailwind, and code Playground
by espace3d
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 || {}
MonsterBunny = function (game, x, y, rotateSpeed,group) {
Phaser.Sprite.call(this, game, x, y, 'rect');
group.add(this);
this.anchor.setTo(.5,.5)
this.rotateSpeed = rotateSpeed;
};
MonsterBunny.prototype = Object.create(Phaser.Sprite.prototype);
MonsterBunny.prototype.constructor = MonsterBunny;
MonsterBunny.prototype.update = function() {
this.angle += this.rotateSpeed;
};
E=E || {}
function create() {
var thisgroup = game.add.group();
var wabbit = new MonsterBunny(game,100,100,2,thisgroup)
game.add.existing(wabbit);
thisgroup.visible=false
}