Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Spring is Coming
PImage bg;
int y;
void setup() {
size(500, 500);
bg = loadImage("Flowers.jpg");
background(bg);
stroke(226, 204, 0);
line(0, y, width, y);
y++;
if (y > height) {
y = 0;
}
}
void draw() {
if(mousePressed ==true)
{
makeLadybug();
}
}
//creates a ladybug
void makeLadybug()
{
int mainX = int(random(500));
int mainY = int(random(500));
fill(255, 0, 0);
ellipse(mainX, mainY, 15, 15);
fill(0);
ellipse(mainX, mainY, 3, 3);
ellipse(mainX + 3, mainY -5, 3, 3);
ellipse(mainX - 3, mainY -5, 3, 3);
fill(0);
ellipse(mainX, mainY+4, 5, 5);
}
//clears away the ladybugs
void keyPressed()
{
bg = loadImage("Flowers.jpg");
background(bg);
stroke(226, 204, 0);
line(0, y, width, y);
y++;
if (y > height) {
y = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.