Getting rid of trail following ball
in
Programming Questions
•
2 years ago
Hey, I'm new to this forum, and pretty new to coding(taking a first year creative coding course atm). At the moment we've got to create a small little interactive program. I'm trying to make one where I can just throw a ball around the screen, change it's colour and so on.
This is what I've got so far,
Was just wondering how I could get rid of the trail of circles that follows the main one.
Any feedback would be great, cheers
int greenfill = 250;
int redfill = 0;
int bluefill = 0;
int count = 1;
float x = (700/2);
float y = (400/2);
void setup(){
size (700,400);
background(255,255,255);
}
void draw(){
noStroke();
smooth();
fill(redfill,greenfill,bluefill,15);
ellipse(x,y,50,50);
if(count<2){
}
dist(x, y, mouseX, mouseY);
if(dist(x, y, mouseX, mouseY) < 60){
if (mousePressed == true) {
x = mouseX;
y = mouseY;
}
if(keyPressed) {
if(key == 'r' || key == 'r') {
redfill = 250;
greenfill = 0;
bluefill = 0;
} }
if(keyPressed) {
if(key == 'g' || key == 'g') {
greenfill = 250;
redfill = 0;
bluefill = 0;
}}
if(keyPressed) {
if(key == 'b' || key == 'b') {
greenfill = 0;
redfill = 0;
bluefill = 250;
}}
}
}
1