anfa Posted March 20, 2015 Share Posted March 20, 2015 I have a sprite that gets created by an on click on a text object, how do I make that sprite draggable with out a second clickfunction startList(selected) { var posx = game.input.mousePointer.x; var posy = game.input.mousePointer.y; console.log(posx); if (canc > 0) { console.log('too many'); } else { canc++; tgf = tta.indexOf(selected.text); tpa = ta[tgf]; game.world.remove(selected); var cad = game.add.sprite(posx, posy, tpa); cad.scale.setTo(0.0); var sm = game.add.tween(cad.scale).to({ x: 0.96, y: 0.96 }, 200); sm.start(); //tape mechanics game.physics.startSystem(Phaser.Physics.ARCADE); game.physics.arcade.enable(cad); cad.inputEnabled = true; cad.input.enableDrag(); cad.events.onDragStart.add(startDrag, this); cad.events.onDragStop.add(stopDrag, this); cad.anchor.setTo(0.5, 0.5); } Link to comment Share on other sites More sharing options...
j0hnskot Posted March 21, 2015 Share Posted March 21, 2015 Check the following : http://www.html5gamedevs.com/topic/9785-duplicate-and-start-drag/ I suspect it's the same case. Link to comment Share on other sites More sharing options...
Recommended Posts