Delete the group but not the sprites in the group.
// 100 blinks then remove the group.
var group = createGroup();
for (var i = 0; i < 20; i++) {
group.add(createSprite(randomNumber(0, 400), randomNumber(0, 400),randomNumber(10, 20),randomNumber(10, 20)));
}
var counter=1;
function draw() {
background("white");
drawSprites();
counter=counter+1;
if (counter%2==1) group.setColorEach("red");
else group.setColorEach("green");
if (counter>100) group.clear();
}
group.clear()
No return value. Changes output in the display after drawSprites() is called.
drawSprites() is called.Found a bug in the documentation? Let us know at documentation@code.org