Search the Community
Showing results for tags 'click event'.
-
So I have a group, and it has three sprites. create() { var parent = game.add.group(); var allSprites = [ 'sprite1', 'sprite2', 'sprite3']; for (i=0; i<3; i++){ childImage = parent.create( game.world.centerX, game.world.centerY+ (i*30), allSprites); childImage.anchor.setTo(0.5, 1); childImage.inputEnabled = true; childImage.input.useHandCursor = true; } } How to I trigger function changeText(); when one of the child sprite is clicked. So far I have tried this method below but it only detects click on the last sprite. update(){ child.events.onInputDown.add(changeText, this); }
- 3 replies
-
- click event
- groups
-
(and 3 more)
Tagged with:
-
Hey guys, so im building a tycoon game were you can buy furniture and place it in your house. I have implemented the drag drop system from the playground (http://www.babylonjs-playground.com) and it works for objects which have been placed on the scene. My issue is is that I now want to click a button to BUY an object (mesh) and as soon as I mouse up from the button the mesh would follow my mouse (like the drag and drop) and stop after I click again to place the object. I have tried to expand the drag drop to allow this but in its current implementation it has to have a click/pick event on the mesh I want to move. Has any one expanded the drag drop to work with and without a click event or do I have to make a second set of functions to do this? Cheers for any help you can pass my way.
- 3 replies
-
- Drag and drop
- babylonjs
-
(and 1 more)
Tagged with: