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
+
1
8
var game = new Phaser . Game ( 600 , 400 , Phaser . CANVAS , 'game' , {
2
9
preload : function preload ( ) {
3
10
game . load . atlasXML ( 'blueSheet' , 'UIpack/blueSheet.png' , 'UIpack/blueSheet.xml' ) ;
@@ -8,6 +15,14 @@ var game = new Phaser.Game(600, 400, Phaser.CANVAS, 'game', {
8
15
this . image . anchor . set ( 0.5 , 0.5 ) ;
9
16
this . textureRender = game . add . renderTexture ( game . width , game . height ) ;
10
17
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 )
11
26
} ,
12
27
update : function update ( ) {
13
28
var pointer = game . input . activePointer ;
0 commit comments