Checks if the sprite is in the group.
// Is the sprite in the group (red) or not? var group = createGroup(); var sprite1 = createSprite(200, 200); if (randomNumber(0, 1)==1) group.add(sprite1); if (group.contains(sprite1)) { group.setColorEach("red"); } function draw() { background("white"); drawSprites(); }
group.contains(sprite)
Name | Type | Required? | Description |
---|---|---|---|
sprite | Sprite | The sprite you want to find in the group. |
Boolean true or false.
Found a bug in the documentation? Let us know at documentation@code.org