I and my teammate am trying to find a cool logo for the brain. We want to make dots move on the screen. We have a current program, shown below. We want to make dots move downward on the screen kinda like a lightning bolt. We start with a random amount of dots and then they are supposed to move downward with a constant Y value but a random X value. When we run the program, it only shows our logo. The dots appear in the top left corner, also known as coordinate (0,0). They don’t move, but they change colors, just like the logo.
Brain.Screen.clearScreen(color(0, 0, 102));
Brain.Screen.setPenColor(yellow);
Brain.Screen.setFillColor(color(0, 0, 51));
Brain.Screen.drawRectangle(-10, -10, 1000, 500);
Brain.Screen.setFont(mono40);
Brain.Screen.printAt(100,100, "teamname");
Brain.Screen.setPenColor(ClrBrown);
Brain.Screen.setFont(mono20);
Brain.Screen.printAt(195, 150, "Authentic");
//pixels
Brain.Screen.setPenColor(yellow);
int dotpos[30] = {};
int randnum = rand()%500+100;
int speed = 1;
srand(time(NULL));
for (int x = 0; x < 30; x+=3) {
if(x%3 ==0) {
dotpos[x] = rand()%250;
} else if (x%3 == 1){
dotpos[x] = rand()%500;
} else if (x%3 == 1) {
dotpos[x] = rand()%4 + 1;
}
//logo color change
while (1) {
if (Logo_Color%2 == 0) {
Brain.Screen.setPenColor(color(0, 204, 255));
} else if (Logo_Color%2 == 1) {
Brain.Screen.setPenColor(yellow);
}
Brain.Screen.setFont(prop60);
Brain.Screen.printAt(85, 100, "teamname");
task::sleep(rand()%350+10);
Logo_Color++;
for(int x = 0; x < 30; x+=3){
Brain.Screen.drawPixel(dotpos[x], dotpos[x+1]);
int new_x = dotpos[x]; //+ dotpos[x+2];
int new_y = dotpos[x+1] + speed;
if(new_y > 250) {
speed = -speed;
} //else if (new_x < 0)
dotpos[x] = new_x;
dotpos [x+1] = new_y;
task::sleep(1);
}
}
}
}
But it does not work. Can anybody find what’s wrong in the code?