Search the Community

Showing results for tags 'foreachalive'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 2 results

  1. Hi i need some help with my school assignment so what i want to do is to kill the children at the same time if all the children's y position more than 820. or if i can check all the position of the children or the group ( i dont think that possible). animals.forEach(function(animal) { var z=0; if (animal.y > 820) { z++; console.log(z); } if (z>6) {animal.kill();} } ); the number of the children is 5 and the problem is the number of z is always 1 therefor the animal.kill() never been process. thought?? or do you have better way to check the position? really appreciate the help guys thanks
  2. Hello. I'm trying to destroy some sprites that belong to a group by looping using the forEachAlive method. Has anyone encountered a this.children is undefined error when trying to destroy a sprite that belongs to a group? Using box.kill() doesn't generate the error, but I thought destroy is better if you're not going to use the sprite anymore because it frees up resources. If I thought wrong, feel free to correct my understanding of destroy vs kill. Thanks! document.getElementById("textinator").onkeydown = function(pressed) { textinator = this; typedAnswer = this.value; correct = false; if (pressed.keyCode == 13) { boxes.forEachAlive(function(box) { if (box.answer == typedAnswer) { correct = true; box.destroy(); //box.kill(); } }); } if (correct) { textinator.value = ""; } else { }}