Loading...
Logo
Processing Forum
I cannot keep working because Processing doesn't like something that I am doing..
It says The Method is not Applicable for the Arguments(int,int,int,int)

Do you know what's going on?

Thanks!


Copy code
  1. int gridHeight; 
  2. int gridWidth; 
  3. float circleRadius;


  4. int drawGridOfCircles;



  5. void setup() {
  6.   gridHeight=5; 
  7.   gridWidth=10; 
  8.   


  9.   size(600, 600);
  10. }

  11. void draw() {
  12. background(255);
  13.   fill(255,0,0);
  14. circleRadius =mouseY/20;



  15.  drawGridOfCircles(gridHeight, gridWidth, mouseX, mouseY);
  16.   //drawGirdOfCircles(20,3,50);
  17. }   


  18. void  drawGridOfCircles() {
  19. //void drawGridOfCircles(int a, int b, float c){  


  20.   for (int i=1;i<gridWidth;i=i+1) { 
  21.     for (int j=1; j<gridHeight; j=j+1) {

  22.       ellipse(i*20, j*20, circleRadius, circleRadius);
  23.     }
  24.   }
  25. }

Replies(14)

I'm assuming that it highlights line 27...

That would be because you are trying to call drawGridOfCircles() with invalid parameters.
The call (line 27):

Copy code
  1. drawGridOfCircles(gridHeight, gridWidth, mouseX, mouseY);

and the declaration (line 32):

Copy code
  1. void  drawGridOfCircles() {

's parameters do not match.
Either clear the parameters for the call or create four ints for the declaration.
Yes, it's line 27 (now 31). 

I need to create four ints for the way I have to keep working. So now I did like this, but it doesn't like it neither..
Maybe this is not the right way to declare the ints?

Thanks!

Copy code
  1. int gridHeight; 
  2. int gridWidth; 
  3. float circleRadiusX;
  4. float circleRadiusY;


  5. int drawGridOfCircles;



  6. void setup() {
  7.   gridHeight=5; 
  8.   gridWidth=10; 
  9.   


  10.   size(600, 600);
  11. }

  12. void draw() {
  13. background(255);
  14.   fill(255,0,0);
  15.   
  16.  
  17. circleRadiusX =mouseX/20;
  18. circleRadiusY =mouseY/20;



  19.  drawGridOfCircles(gridHeight, gridWidth, circleRadiusX,circleRadiusY);

  20. }   


  21. void  drawGridOfCircles() {
  22. //void drawGridOfCircles(int a, int b, float c){  


  23.   for (int i=1;i<gridWidth;i=i+1) { 
  24.     for (int j=1; j<gridHeight; j=j+1) {

  25.       ellipse(i*20, j*20, circleRadiusX, circleRadiusY);
  26.     }
  27.   }
  28. }
Lines 31 and 36 must match (same numbers of parameters).

You call it with: int int float float

Thus

void drawGridOfCircles ()

would need 4 parameters.

On the other hand: 
Leave 36 as it is.

Line 31: 

drawGridOfCircles () ;

without Parameters 

Since the vars you want to pass are global vars anyway - no need to pass them.


That's great, and I understood what you mean. Now I was able to keep going on my work.

Thank you! 


Lol.. Don't' say it twice... lol
But I appreciate your thought!

I am having exactly a similar problem here, and I still don't get what's wrong.

Line 11, it cannot find anything called drawSquares and so i am stuck again.
Do you know what do I miss now?

Thanks



Copy code
  1. int x =0;
  2. int y =0;


  3. void setup() {

  4.   {
  5.     size(400, 400);
  6.     fill(0);
  7.     drawSquares=rect(x, y, 20, 20);

  8.     drawSquares(19);
  9.   }
  10. }

  11.   void drawSquares (float number) {
  12.     while (x<width) {  


  13.       while (y<height) {
  14.         
  15.         rect(x, y, 20, 20);

  16.         y=y+height;
  17.       }
  18.       
  19.       y=0;
  20.       x= x+40;
  21.     }
  22.   }
The compiler thinks you are trying to assign a variable called drawSquares to be the value of rect(x, y, 20, 20);, which is void.

What exactly are you trying to do?
Is just:

Copy code
  1. rect(x, y, 20, 20);

what you need?
Having a number (as you see in my example, in line 13 -drawSquares(19)-), I have to draw a line of Squares using while loop.

I think the rest of the code should work, but it doesn't let me go forward.

What do you think I should do? It doesn't like anything I am doing right now..
No, what are you trying to achieve with line 11?
It should be the first square that I am going loop using the while loop. 

It is in position x, y and dimension 20, 20
Quite frankly, I don't understand what you're doing.
Do you need the portion of it that comes before the equals sign?
What happens when you get rid of that line?
At the end I did like this, I took it away and I called at the top. It's just a simple line of squares, but it works!

Thank you so much for all your help! 

Copy code
  1. int x =0;
  2. int y =0;
  3. float drawSquares;

  4. void setup() {
  5.     size(400, 400);
  6.     fill(0);


  7.     drawSquares(19);
  8.   }


  9.   void drawSquares (float number) {
  10.     while (x<width) {  


  11.       while (y<height) {
  12.         
  13.         rect(x, y, 20, 20);

  14.         y=y+height;
  15.       }
  16.       
  17.       y=0;
  18.       x= x+40;
  19.     }
  20.   }
Yes! To get rid of that line was such a great idea!