Here, which means although not all the they are moving the same direction, I want their face to move forward the way they r moving. and I don't know how to do it so could u help me!. and I don't want long code.
let x = [];
let y = [];
let d = [];
let s = [];
let z = [-1, 1];
function setup() {
createCanvas(1280, 720);
colorMode(HSB, 360, 100, 100, 100);
for (let i = 0; i < 11; i++) {
x[i] = i * 50;
d[i] = random(20) * random(z);
s[i] = random(50, 500);
y[i] = random(height);
}
}
function draw() {
background("black");
noStroke();
for (let i = 0; i < 11; i++) {
fill((i + 1) * 36, 100, 100, 50);
arc(x[i], y[i], s[i], s[i], radians(30), radians(330), PIE); //pacman shape
fill(0);
circle(x[i] + 10, y[i] - s[i] / 4, 10);
if (i % 2 == 0) {
x[i] = x[i] + d[i];
if (x[i] > width) {
x[i] = 0;
}
} else {
x[i] = x[i] - d[i];
if (x[i] < 0) x[i] = 1280;
}
}
}