int miyashita_posX; int miyashita_posY; int miyashita_speedX; int miyashita_speedY; int komatsu_posX; int komatsu_posY; int komatsu_speedX; int komatsu_speedY; int fukuchi_posX; int fukuchi_posY; int fukuchi_speedX; int fukuchi_speedY; void setup() { size( 400, 300 ); miyashita_posX = (int)random( 0, width ); miyashita_posY = (int)random( 0, height ); miyashita_speedX = (int)random( 1, 5 ); miyashita_speedY = (int)random( 1, 5 ); komatsu_posX = (int)random( 0, width ); komatsu_posY = (int)random( 0, height ); komatsu_speedX = (int)random( 1, 5 ); komatsu_speedY = (int)random( 1, 5 ); fukuchi_posX = (int)random( 0, width ); fukuchi_posY = (int)random( 0, height ); fukuchi_speedX = (int)random( 1, 5 ); fukuchi_speedY = (int)random( 1, 5 ); fill( 255, 0, 0 ); } void draw() { background( 255 ); miyashita_posX += miyashita_speedX; miyashita_posY += miyashita_speedY; komatsu_posX += komatsu_speedX; komatsu_posY += komatsu_speedY; fukuchi_posX += fukuchi_speedX; fukuchi_posY += fukuchi_speedY; if ( miyashita_posX > width-15 ) { miyashita_posX = width-15; miyashita_speedX = -miyashita_speedX; } if ( miyashita_posX < 15 ) { miyashita_posX = 15; miyashita_speedX = -miyashita_speedX; } if ( miyashita_posY > height-15 ) { miyashita_posY = height-15; miyashita_speedY = -miyashita_speedY; } if ( miyashita_posY < 15 ) { miyashita_posY = 15; miyashita_speedY = -miyashita_speedY; } if ( komatsu_posX > width-15 ) { komatsu_posX = width-15; komatsu_speedX = -komatsu_speedX; } if ( komatsu_posX < 15 ) { komatsu_posX = 15; komatsu_speedX = -komatsu_speedX; } if ( komatsu_posY > height-15 ) { komatsu_posY = height-15; komatsu_speedY = -komatsu_speedY; } if ( komatsu_posY < 15 ) { komatsu_posY = 15; komatsu_speedY = -komatsu_speedY; } if ( fukuchi_posX > width-15 ) { fukuchi_posX = width-15; fukuchi_speedX = -fukuchi_speedX; } if ( fukuchi_posX < 15 ) { fukuchi_posX = 15; fukuchi_speedX = -fukuchi_speedX; } if ( fukuchi_posY > height-15 ) { fukuchi_posY = height-15; fukuchi_speedY = -fukuchi_speedY; } if ( fukuchi_posY < 15 ) { fukuchi_posY = 15; fukuchi_speedY = -fukuchi_speedY; } ellipse( miyashita_posX, miyashita_posY, 30, 30 ); ellipse( komatsu_posX, komatsu_posY, 30, 30 ); ellipse( fukuchi_posX, fukuchi_posY, 30, 30 ); }