Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2017 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/dfa01a422a6d280711bf5f68425d0a6a to your computer and use it in GitHub Desktop.
Save anonymous/dfa01a422a6d280711bf5f68425d0a6a to your computer and use it in GitHub Desktop.
Meda102 shared code
/**
* This function draws a target.
* It takes 2 parameters (x and y) which define
* the position of the target that is drawn.
* x: the distance in pixels from the top left
* y: the distance in pixels from the top right
**/
void drawTarget(float x, float y) {
noStroke();
for (int i = 0; i < 50; i = i + 5) {
if (i%2 == 0) { // this line says "if i is an even number then..."
fill(255); // fill in white
} else { // otherwise
fill(0); // fill in black
}
ellipse(x, y, 50 - i, 50 - i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment