espace Posted July 7, 2016 Share Posted July 7, 2016 hi, is it possible to store graphics in a table to have different name of my graphics (player and opponent) ? the main reason is to have only one object to add in my container and be able to recognize each element of background. I try with this but it's not the good format it seems.... thanks for your advice. var w = 320 var h = 480 var w2 = w/2 var h2 = h/2 var red=0xFF0000 var blue=0x009AFF var background={} background.opponent=new PIXI.Graphics() background.opponent.beginFill(red); background.opponent.drawRect(0,0,w2,h); background.player=new PIXI.Graphics() background.player.beginFill(black); background.player.drawRect(w2,0,w2,h); Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 7, 2016 Share Posted July 7, 2016 var background= new PIXI.Container(); background.opponent=new PIXI.Graphics() background.opponent.beginFill(red); background.opponent.drawRect(0,0,w2,h); background.addChild(background.opponent); background.player=new PIXI.Graphics() background.player.beginFill(black); background.player.drawRect(w2,0,w2,h); background.addChild(background.player); Quote Link to comment Share on other sites More sharing options...
espace Posted July 7, 2016 Author Share Posted July 7, 2016 damn what i'm stupid thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.