Created
April 15, 2019 16:08
-
-
Save Jl9549/c40df7100e3f9569979c8c75add094a8 to your computer and use it in GitHub Desktop.
Spring is Coming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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