Unexpected void error

void setup(){
size(900,900);
background(255);
}

void draw(){
for(int x = 0; x < height; x = x+90){
for (int y = 0; ABy < width; y = y+90){
shapeX(x, y, 90, 90, random(255));
}
}

void shapeX(float x, float y, float z, float a, float c){
beginShape();
noStroke();
fill©;
ellipse(x, y, z+40, a+40);
translate(-58,-58);
noStroke();
fill©;
rect(x, y, z+25, a+25);
endShape(CLOSE);
}

type or paste code here

© = ( c )

.

.
.

.
.

.
.
.
.
.
.
.
.
.
.
.

Hi,

Welcome to the forum!

It seems that there’s a strange character in your code! It’s probably due to fill© twice.

In Java, you the grammar of the language doesn’t include the copyright sign except for strings of course :wink:

PS : remember to format your code by using the </> button in the message editor on the forum

hey, thankyou but © is ( c ) within the code.
i am beginner to processing so i am clueless rightnow as to what do to.

I don’t understand, where does your code come from? You would never have © character in your code but rather fill(c);

i get you,
actually in my code its ( c ) without the spaces within the bracket but in this website when we type and upload ( c ) it becomes ©.
this is not the problem tho.

Ok well anyway it’s strange :wink:

Changing the corresponding lines and pressing Ctrl+T in the Processing editor to auto format the code (handy tip!), I get an error at line 10 saying that there’s a missing curly bracket.

In fact you forgot to close the draw() function block. (in general when you open a bracket, you need to close it)

This is the corrected code :

void setup() {
  size(900, 900);
  background(255);
}

void draw() {
  for (int x = 0; x < height; x = x+90) {
    for (int y = 0; y < width; y = y+90) {
      shapeX(x, y, 90, 90, random(255));
    }
  }
}

void shapeX(float x, float y, float z, float a, float c) {
  beginShape();
  noStroke();
  fill(c);
  ellipse(x, y, z+40, a+40);
  translate(-58, -58);
  noStroke();
  fill(c);
  rect(x, y, z+25, a+25);
  endShape(CLOSE);
}

I don’t think that it’s the result that you want but this is a starting point

Thanks and you are right, this is not the result i am looking for XD.
if you can and if you want.
please help me with this code.
what I want to do is to fill the sketch area with shapeX(with i made within the code) in checker box manner

Ok let’s go over this :wink: :

  • I suppose that you don’t want to animate your sketch based on your description so you can use noLoop() at the end of the draw function to break the loop. We want to only draw once.

  • Also you are misleading with the usage of beginShape() / endShape(), they are used when you want to draw a shape using custom points (not a rectangle or an ellipse since those shapes already have their own pre defined functions)

  • Using translate() will move the whole coordinate system, in this case you rather want to display your rect with an offset of -58.

  • When using fill() or noStroke(), it’s like a state machine. Unless you call again fill() with another color, it’s going to stay the same. So you can call them once before drawing your shapes

  • When your pattern is working properly, you can see that the last column and row are not drawn. Can you find what to change in order to display the whole pattern correctly?

  • Also try to put spaces in your code as it increases readability

Try to change your code to make it work and then I can post the full solution! :slight_smile: