I am having some trouble doing a basic thing. I would like to have circle walking like this on screen. If you look at the link, he has written code for the art which I am using but it is somehow incorrect in Processing. I am struggling with the output of this code. All I get is a circle once I run the code. Could you guys please help me figure out what I’m doing wrong.
float x = 200;
float y = 200;
float s = 50;
float m = 5;
void setup(){
size(700,700);
background(255,255,255);
}
void draw(){
ellipse(50,50,75,75);
x = x + random(350);
y = y + random(350);
}
float x = 200;
float y = 200;
float s = 50;
float m = 5;
void setup(){
size(700,700);
background(255,255,255);
frameRate(4);
}
void draw(){
background (0);
ellipse(1+y,1+x,75,75);
x = x + random(35);
y = y + random(35);
}
(Which makes it possible that 0 occurs or very small values. There is a workaround with random 3,35 and then use a 2nd random to make that negative in 50 % of the cases. But here it’s okay to have 0 values)
Also look at references for setup(), size() and draw().
Also a good resource: https://happycoding.io/ < There is an example in there that may be of interest.
Once you understand this code take a step back and start with a blank sketch and write your code from scratch. This will help develop your programming skills and this is a nice simple example to start with.