sombriks Posted April 22, 2015 Share Posted April 22, 2015 Hello all, i'm defining my sprites like this:var e1p2 = game.add.sprite(244, 583, "folha128x128", 4)// e1p2.anchor.set(0.5, 0.5);However i have several lines like that. where could i define a default anchor on phaser? Thanks in advance. Link to comment Share on other sites More sharing options...
icp Posted April 23, 2015 Share Posted April 23, 2015 1. The hard way - create an object constructor and use :this.anchor.setTo(0.5, 0.5);For every new instance created the anchor will be (0.5, 0.5); 2. The easy way - put all your sprites in a group :var brands = game.add.group();brands.create (100, 50, 'Samsung');brands.create (150, 100, 'Apple');brands.create (200, 150, 'LG');brands.children.forEach(function(brands){ brands.anchor.setTo(0.5, 0.5);}); drhayes 1 Link to comment Share on other sites More sharing options...
Recommended Posts