Jump to content

Search the Community

Showing results for tags 'group sprite index'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 1 result

  1. Hi Guys, Complete phaser noob and JS amateur!! Probably an easy answer but how do I access a sprite having created it in a group? I'm not sure which sprite the user will choose first, second etc but need to be able to access the chosen sprites x,y coordinates as well as it's index in the group so I can disable input on that sprite. Hope this makes sense:) My code: //create sprite randNum = game.rnd.integerInRange(1,9); sheep = game.add.group(); game.physics.arcade.enable(sheep); sheep.enableBody = true; for (i = 0; i < randNum; i++){ randX = game.rnd.integerInRange(10,460); randY = game.rnd.integerInRange(150,540); var lamb = sheep.create(randX,randY,'sheep'); lamb.anchor.setTo(0.5,0.5); lamb.inputEnabled = true; lamb.input.enableDrag(true); lamb.events.onDragStart.add(dragStart); lamb.events.onDragStop.add(dragStop); } I would like to do something like this in the dragStop event: function dragStop(){ if (lamb.x > 500 && lamb.x < 750){ soundIndex++; lamb.inputEnabled = false; } Cheers J
  • Create New...