sinanqd10 Posted August 4, 2016 Share Posted August 4, 2016 Hi guys, I would like to ask about group events and position that I assigned manually. If there a clean way to approach this? this.mouth1 = this.mouthGroup.create(150, 40, 'mouth1'); this.mouth1.inputEnabled = true; this.mouth1.input.enableDrag(); this.mouth1.events.onDragStart.add(this.onDragStart, this); this.mouth1.events.onDragStop.add(this.onDragStop, this); this.mouth1.scale.setTo(0.5); this.mouth1.anchor.setTo(0.5); this.mouth2 = this.mouthGroup.create(150, 120, 'mouth2'); this.mouth2.inputEnabled = true; this.mouth2.input.enableDrag(); this.mouth2.events.onDragStart.add(this.onDragStart, this); this.mouth2.events.onDragStop.add(this.onDragStop, this); this.mouth2.anchor.setTo(0.5); this.mouth2.scale.setTo(0.5); this.mouth3 = this.mouthGroup.create(150, 200, 'mouth3'); this.mouth3.inputEnabled = true; this.mouth3.input.enableDrag(); this.mouth3.events.onDragStart.add(this.onDragStart, this); this.mouth3.events.onDragStop.add(this.onDragStop, this); this.mouth3.anchor.setTo(0.5); this.mouth3.scale.setTo(0.5); etc.... Link to comment Share on other sites More sharing options...
sinanqd10 Posted August 4, 2016 Author Share Posted August 4, 2016 I found this way this.mouthGroup.forEach(function(item) { item.inputEnabled = true; item.events.onInputDown.add(this.clickDown, this); item.events.onInputUp.add(this.clickUp, this); item.anchor.setTo(0.5); item.scale.setTo(0.5); }, this); Link to comment Share on other sites More sharing options...
Recommended Posts