/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://hewitt.sketchpad.cc/sp/pad/view/ro.DTbgT5fZTGk/rev.46
*
* authors:
* Caroline Hoffman
* Erik Nauman
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// This sketch builds on a prior work, "Playful Project", created by Erik Nauman
// http://hewitt.sketchpad.cc/sp/pad/view/ro.8j2unppjCvd$Br/rev.43
/* @pjs preload="/static/uploaded_resources/p.8795/ballcopy.png"; */
/* @pjs preload="/static/uploaded_resources/p.8795/soccer.jpg"; */
PImage ball;
PImage img;
int x;
int y;
int change = -10;
int w = 40;
PFont f;
void setup() {
size(500,500);
x= width/2 - w/2;
y = height;
img = loadImage("/static/uploaded_resources/p.8795/soccer.jpg");
ball=loadImage("/static/uploaded_resources/p.8795/ballcopy.png");
image(img,0,0,width,height);
}
void draw() {
frameRate(60);
image(img,0,0,width,height);
image(ball,x,y,w,w);
y = y + change;
if(y < height/2 + 75) {
change = 0;
goal ();
y = height;
change = -10;
}
if( y > height/2 + 100) {
if(mousePressed &&
mouseX > x &&
mouseX < x+w &&
mouseY > y &&
mouseY < y +w) {
y= height;
}f = loadFont("ArialMT-50.vlw");
}
}
void goal (){
textAlign(CENTER);
for(int i = 8;i >=0; i--) { //the loop will count down so the smaller words will be in front, not covered up
fill(30*i); //gray value starts lighter and gets darker as the loop progresses
textFont(f,i*20);//font size will start big, get smaller
text("GOAL", width/2,height/2);
frameRate(1);
}
}