Beginners Journey
in
Programming Questions
•
2 years ago
Hey there, I stumbled upon Processing through some friends and have decided to give this a bash. I have done little bits of programming before in Java and HTML (Not a proper programming langauge, but it is close enough)
I have got the book and just slowly working my way through it and I'm just trying to do some small little challenges myself but I have clearly made it a little bit too hard for myself!
I am trying to design a little app where a circle appears and when you click on the circle it disappears and a new one takes it's place. Havn't quite got it yet, I have circles appearing when I click but not quite the way I want it to work. I have two seperate codes which is kinda in the direction I need to go but need to combine the two and make it work somehow. I have tried using arrays for the random X's,Y's etc but the result was that it just diagonally down with random circle sizes.
- int locationX = int(random(25,225));
int locationY = int(random (25,550));
int circleX = int(random (25,75)); - void setup(){
size(250, 600);
background(0);
} - void draw(){
ellipse(locationX, locationY, circleX, circleX);
} - void mousePressed(){
if (mouseX >locationX && mouseX < locationX-circleX && mouseY > locationY && mouseY < locationY-circleX);
background(255);
}
void setup(){
size(250, 600);
background(0);
}
-
void drawCircle(){
int locationX = int(random(25,225));
int locationY = int(random (25,550));
int circleX = int(random (25,75));
ellipse(locationX, locationY, circleX, circleX);
}
-
void draw(){
if(mousePressed){
drawCircle();
}
}
1

ML means markup language. It has no loops, no conditionals, no variables, hard to code with it...