Little Problem with the random function

So for the Start I just wanted to programme a little game. So in the game you have to catch balls with a bucket. So I just wanted to randomize were the balls are dropping but instead of choosing 1 location he chooses 100 locations while the ball is slowly moving down.

var Ball = 0
var Bomb = 0
var f1
var f2
var f3
var f4
var f5

function setup() {
	createCanvas(800, 800);
}

function draw() {
	background(19, 255, 255);
	//var k=randomSeed(width);
	var f1 = random(width);
	var f2 = random(width);
	var f3 = random(width);
	var f4 = random(width);
	var f5 = random(width);

	rectMode(CENTER);
	rect(mouseX, 650, 100, 100);

	noStroke();
	fill(255, 10, 0);
	ellipse(f1, Ball, 20, 20);
	ellipse(f2, Ball, 20, 20);
	ellipse(f3, Ball, 20, 20);
	ellipse(f4, Ball, 20, 20);
	ellipse(f5, Ball, 20, 20);

	Ball = Ball + 4
}
1 Like

try to move that up to the setup function?
but without new declaration!

f1 = random(width);
f2 = random(width);
f3 = random(width);
f4 = random(width);
f5 = random(width);
2 Likes

Thanks. It worked
I tried that for hours