turn random values into static
in
Programming Questions
•
1 year ago
Hi, i am new into programming and i wanted to ask you how to turn a random value into static.
i made a program with a crosshair and circles and i want the circles to be drawn in random places, maintain their values and then make them move in a diagonal direction. but instead, i have a lot of circles flickering all over the window.
here is the code:
float randomx, randomy, posx, posy;
void setup() {
size(800, 600);
}
void draw() {
randomx = random(0, width);
randomy = random(0, height);
posx = randomx;
posy = randomy;
rect(0, 0, width, height);
fill(255, 50);
line(0, mouseY, width, mouseY);
line(mouseX, 0, mouseX, height);
ellipse (posx, posy, 10, 10);
}
i made a program with a crosshair and circles and i want the circles to be drawn in random places, maintain their values and then make them move in a diagonal direction. but instead, i have a lot of circles flickering all over the window.
here is the code:
float randomx, randomy, posx, posy;
void setup() {
size(800, 600);
}
void draw() {
randomx = random(0, width);
randomy = random(0, height);
posx = randomx;
posy = randomy;
rect(0, 0, width, height);
fill(255, 50);
line(0, mouseY, width, mouseY);
line(mouseX, 0, mouseX, height);
ellipse (posx, posy, 10, 10);
}
1