First of all, sorry for my bad english. Hello i’m a French student, I’ve got a homework about a class to create balls. I’ve followed the teacher’s classes but I’m stuck with an unexpected token. You should understand my code by reading it in full. Thank you.
Here is my code :
Welcome to the forum. Don’t worry about your English. It looks just fine. I’m from Finland and there are lot’s of people on the forum who uses English as a second language.
Drawing circles or any graphical elements uses fill (color) and stroke (color and weight) attributes. Fill tells what color fills the inside of the shape and stroke tells what color is used to draw the outline.
circle(x, y, 40);
fill(255, 0, 0);
first draws and then sets fill color to red (red 255, green 0 and blue 0 gives red). Fill and stroke color stay until they are changed. And you have used function noStroke() which tells processing not to draw outlines at all. It’s in effect until stroke color is set again with stroke() -function
If you want to use color given in constructor of the ball new Balle(100, 100, color(255,255,255));
You need to change void Afficher() function so that you first set the fill color and then draw. To use color given in constructor you just use it as a parameter for fill(); By the way you set white as your balls colour in your constructor so it would draw white on white background.
You should not use variable names that are reserved, they cause all sorts of grief. So change variable color to something else “couleur” perhaps.