Skip to content

Commit 3c101a3

Browse files
committed
update example
1 parent 80e7d13 commit 3c101a3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

example/game.js

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
function MyClass(game){
2+
Phaser.Sprite.apply(this, arguments);
3+
game.add.existing(this);
4+
}
5+
MyClass.prototype = Object.create(Phaser.Sprite.prototype);
6+
MyClass.prototype.constructor = MyClass;
7+
18
var game = new Phaser.Game(600, 400, Phaser.CANVAS, 'game', {
29
preload: function preload() {
310
game.load.atlasXML('blueSheet', 'UIpack/blueSheet.png', 'UIpack/blueSheet.xml');
@@ -8,6 +15,14 @@ var game = new Phaser.Game(600, 400, Phaser.CANVAS, 'game', {
815
this.image.anchor.set(0.5, 0.5);
916
this.textureRender = game.add.renderTexture(game.width, game.height);
1017
this.textureRenderedSprite = game.add.sprite(0, 0, this.textureRender);
18+
19+
this.myGroup = game.add.group();
20+
this.mySprite = new MyClass(game, 250, 150, 'blueSheet', 'blue_button02.png');
21+
this.mySprite.anchor.set(0.5, 0.5);
22+
this.myGroup.add(this.mySprite)
23+
this.mySprite2 = new MyClass(game, 350, 250, 'blueSheet', 'blue_button02.png');
24+
this.mySprite2.anchor.set(0.5, 0.5);
25+
this.myGroup.add(this.mySprite2)
1126
},
1227
update: function update() {
1328
var pointer = game.input.activePointer;

0 commit comments

Comments
 (0)