expecting EOF found "else"
in
Programming Questions
•
11 months ago
keeps coming up with
expecting EOF found "else"
when i go to play this code? anyone know why?
PImage bg;
PImage mi;
float angle;
float tx = 0;
float ty = 0;
int dotCount = 50;
float[] xn = new float [dotCount];
float[] yn = new float [dotCount];
//changes speed of ellipses
float[] s = new float [dotCount];
void setup(){
size(1000,500);
smooth();
bg = loadImage("space.png");
mi = loadImage("mouse.png");
background(bg);
}
{ int i = 0;
int l = 0;
while (i < dotCount){
xn[i] = random (1000);
yn[i] = random (500);
s[i] = random (10);
i = i + 1; }
}
void draw() {
{
tx += (mouseX-tx)/40.0;
ty += (mouseY-ty)/40.0;}
{ translate(width/tx,height/ty);
angle = atan2(mouseY-width/40,mouseX-height/40);
rotate(angle);
image(mi,tx-50,ty+50, tx+50,ty+50);
}}
{
background (bg);
fill(255,255,255,150);
stroke(255,255,255,120);
strokeWeight(5);}
{if (mousePressed) {
{ int i = 0;
int l = 0;
while (i < dotCount){
xn[l] = (tx+random(60));
yn[l] = (ty+random(150));
s[i] = random (10);
i = i + 1; }
}}
translate(mouseX, mouseY);
rotate(angle);
translate(-mouseX, -mouseY);
angle += PI / 72;
for (int i = 0; i < dotCount; i++) {
ellipse(xn[i], yn[i], 20, 20);
}
}
else {
for (int i = 0; i < dotCount; i++) {
ellipse(xn[i], yn[i], 20, 20);
// makes ellipses move
xn[i] += s[i];
//makes them keep going accross page.
if (xn[i] > 1000) {
xn[i] = 0;
}}
}}
1