Mohammad Rahat hw 3.2 part 3

int x = 300;
int speed = 10;

void setup() {
size (600, 600);
}

void draw() {
background(0);
stroke(0, 255, 0);
fill(0, 0, 255);
ellipse(x, x, 100, 100);

if (x > width) {
speed = speed * -1;
}

else if (x < 0) {
speed = speed * -1;
}

x = x+speed;
}

void mousePressed(){
background(0,0,255);
}

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *