AdamRyanGameDev Posted March 9, 2018 Share Posted March 9, 2018 I would like to make a group interactive. The following did not work groupOfZombies.setInteractive(); Then just to add the resulting code to discover which sprite was clicked needs to me access the sprite-key, i have been looking for it but I can't seem to find it (mainly because most code functions using 'this') spriteCat2.setInteractive(); spriteCat2.on('pointerdown', function () { var thisSpriteName = this.key; console.log(thisSpriteName); }); any help would be appreciated! Link to comment Share on other sites More sharing options...
rich Posted March 9, 2018 Share Posted March 9, 2018 You could do: this.input.setHitArea(group.getChildren()); To figure out which sprite was clicked there are several ways of doing it. Either the 'gameobjectdown' events, or listen on the sprite itself. There's a tutorial about exactly this here: https://madmimi.com/p/a022cb lemmikens, AdamRyanGameDev and JHenriP 3 Link to comment Share on other sites More sharing options...
AdamRyanGameDev Posted March 9, 2018 Author Share Posted March 9, 2018 As always thank you Rich! Link to comment Share on other sites More sharing options...
lemmikens Posted December 5, 2018 Share Posted December 5, 2018 Just to elaborate on Rich's answer since it wasn't abundantly clear to me because I'm a noob and I had to fiddle with it a bit... this.input.setHitArea(groupName.getChildren()).on('gameobjectdown', function(pointer, gameObject) { }); Link to comment Share on other sites More sharing options...
Recommended Posts