I want to have it in my code such that all of the sprites in a group variable spawn in different locations once in the draw function. The problem I am currently having is that since the draw function constantly repeats, all of the sprites are constantly changing positions due to this; and as you can imagine, they are rapidly moving all across the screen.
drawSprites(toppingsGroup);
for (var i = 0; i < toppingsGroup.length; i++) {
toppingsGroup[i].position.x = 600;
toppingsGroup[i].position.y = random(height);
}
Aucun commentaire:
Enregistrer un commentaire