Mike018 Posted November 14, 2016 Share Posted November 14, 2016 For dragging groups consisting of multiple sprites to make up 1 "sprite", is this the best way to go about it? Just updating all the sprites to the position of the dragged 'primary' sprite when the drag is active? It works, but it seems pretty inefficient and the update method would get crowded if I had a lot of groups that need to be dragged. createBee() { this.beeWingBack = this.create( x, y, 'atlas1', 'objects/beeWingQueenBack' ); this.beeBody = this.create( x, y, 'atlas1', 'objects/beeBodyQueen' ); this.beeFace = this.create( x, y, 'atlas1', 'objects/beeFaceQueenDefault' ); this.beeWingFront = this.create( x, y, 'atlas1', 'objects/beeWingQueenFront' ); } activateDrag() { this.beeBody.inputEnabled = true; this.beeBody.input.enableDrag(); this.dragEnabled = true; } update() { if(this.dragEnabled === true) { this.beeFace.position.x = this.beeBody.position.x; this.beeFace.position.y = this.beeBody.position.y; this.beeWingFront.position.x = this.beeBody.position.x; this.beeWingFront.position.y = this.beeBody.position.y; this.beeWingBack.position.x = this.beeBody.position.x; this.beeWingBack.position.y = this.beeBody.position.y; } Link to comment Share on other sites More sharing options...
Recommended Posts