Starting position question
in
Programming Questions
•
11 months ago
Hello,
The code below does what I want, however when I remove "noLoop()" I would like the starting position to be in the same spot. With noLoop() removed, it jumps all over the place. What can be done?
Thanks
- int y;
- int startY;
- void setup() {
- size(600,600);
- background(0);
- stroke(#FFDE15);
- fill(#FFDE15);
- noLoop();
- startY = height/2;
- smooth();
- }
- void draw() {
- background(0);
- //println(mapY);
- for (int x = 0; x < width; x++) {
- point(x,startY);
- point(x, startY+y*6);
- randomwalk();
- }
- //saveFrame("line-######.png");
- //println(y);
- }
- void randomwalk() {
- int choice = int(random(2));
- if (choice == 0) {
- y++;
- }
- else {
- y--;
- }
- //println(choice);
- }
1