Cyberguille Posted October 16, 2015 Share Posted October 16, 2015 I have a container with a group of with one child sprite objects. So my target is to have this sprites in two rows. Fragment of my code: var container = new PIXI.Container(); stage.addChild(container); for (var j = 0; j < 2; j++) { for (var i = 0; i < options.length/2; i++) { console.log("j: "+ j); console.log("i: "+ i); var sprite= options[j*4+i]; console.log("140 * j="+ 140 * j); console.log("140 * i="+140 * i); sprite.position.set(140 * j,140 * i); console.log("x: "+ sprite.x); console.log("y: "+ sprite.x); container.addChild(sprite); }; }; container.x=200; container.y=300; but this is what I get: and when I debug with google chrome I see this: So the values of x and y are not taking the values that I think should have, as you can see above in my codesprite.position.set(140 * j,140 * i);then is impossible that 140*i=280 and y=0 this is the fragment to create each sprite:function numberContainer(a,texture){ var slice = new PIXI.Sprite(texture); slice.anchor.set(0.5,0.5); slice.heigth = slice.width =a; slice.buttonMode = true; slice.interactive = true; slice.on('mousedown',function(){ //do something }); return slice;}any idea please, thanks in advance Quote Link to comment Share on other sites More sharing options...
xerver Posted October 17, 2015 Share Posted October 17, 2015 I'm confused about what the issue you are having is, the screenshot looks like what your code would output, the debug output looks like what your code should output, and you never mention what is wrong. 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.