Hi, i got this random walker working well :
but when i try to make it into an object, it doesnt move , this is the code :
- R r;
- void setup (){
- r = new R(0.1);
- smooth();
- size (600,400);
- fill (#F50056);
- rect (0,0,width,height);
- }
- void draw (){
- //background (0);
- r.display();
- }
- class R{
- float t =0;
- float ty =1;
- float y = noise (ty);
- float x = noise (t);
- R(float t_){
- t = t_ ;
- }
- void display (){
- ty = ty + 0.015;
- x = map (x,0,1,0,width);
- y = map (y,0,1,0,height);
- fill (255);
- noStroke ();
- ellipse ( x,y,2,2);
- }}
Thanks !
1