Search the Community
Showing results for tags 'onDrag'.
-
My problem is the same as the post at http://www.html5gamedevs.com/topic/2660-bring-sprite-to-front-over-all-other-groups/ , which states... The solution presented was This solution is exactly what I am looking for, however, when I try to implement it, the second drag (which moves the child from a small parent onto a group above) makes the child fly to a weird place. I've tried putting it back under the mouse by explicitly using position.x/.y, but that seems to fail. Any ideas on how I can correct this?
-
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 click function 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); }