espace Posted July 22, 2016 Share Posted July 22, 2016 hi, Could you help me please to transform this snippet in a prototype function to have an oop object ? with pixi.js i could do it but with phaser i'm a little lost... thanks for your tips. function draw(e,game,nameA,posx,posy,wi,he,valueAlpha,anchorValue) { var e=game.add.sprite(0,0,nameA); e.x=posx; e.y=posy; e.width=wi; e.height=he; e.anchor.set(anchorValue) e.alpha=valueAlpha return e } //final drawing function drawE(e,game) { var e=[] e.player=draw(e,game,"rect",0,0,w,h,1,0) e.opponent=draw(e,game,"rect",w2,0,w,h,1,0) return e } var background= drawE(this.background, game) Link to comment Share on other sites More sharing options...
Recommended Posts