703
edits
(→Code) |
No edit summary |
||
Line 18: | Line 18: | ||
for (int i=0; i < 5; i++) { | for (int i=0; i < 5; i++) { | ||
ball[i] = new Ball(); | ball[i] = new Ball(); | ||
ball[i].x = random(ball[i].g,a-ball[i].g); | ball[i].x = random(ball[i].g,a-ball[i].g); | ||
ball[i].y = random(ball[i].g,height-ball[i].g); | ball[i].y = random(ball[i].g,height-ball[i].g); | ||
} | } | ||
for (int i=5; i < 10; i++) { | for (int i=5; i < 10; i++) { | ||
ball[i] = new Ball(); | ball[i] = new Ball(); | ||
ball[i].x = random(a+c+ball[i].g,a+c+b-ball[i].g); | ball[i].x = random(a+c+ball[i].g,a+c+b-ball[i].g); | ||
ball[i].y = random(ball[i].g,height-ball[i].g); | ball[i].y = random(ball[i].g,height-ball[i].g); | ||
} | } | ||
for (int i=10; i < ball.length; i++) { | for (int i=10; i < ball.length; i++) { | ||
ball[i] = new Ball(); | ball[i] = new Ball(); | ||
ball[i].x = random(a+c+b+c+ball[i].g,width-ball[i].g); | ball[i].x = random(a+c+b+c+ball[i].g,width-ball[i].g); | ||
ball[i].y = random(ball[i].g,height-ball[i].g); | ball[i].y = random(ball[i].g,height-ball[i].g); | ||
} | } | ||
} | } | ||
Line 125: | Line 109: | ||
Ball() { | Ball() { | ||
g = 100; | g = 100; | ||
vx = random(1,10); | |||
vy = random(1,10); | |||
h = (int)random(360); | |||
s = 100; | s = 100; | ||
b = 100; | b = 100; |
edits