Hello, i’m trying to create code for when mouse is clicked, a ball is projected (upwards), but as it moves it gradually slows down. So far all i’ve manage to figure out is make it move up and down. I’m a complete beginner so any help would be greatly appreciated.
int ypos;
boolean hitBottom;
void setup(){
ypos = 0;
hitBottom = false;
}
void draw(){
background(255);
if (ypos == height){
hitBottom = true;
}
noStroke();
fill(92, 136, 218);
circle(width/2, ypos, 20);
if (hitBottom){
ypos--;
} else {
ypos++;
}
}