Reputation: 9
Okay. So, I'm a kid, trying to program a cool little 3d game, and then this... issue decides to take a crap on my next few days.
I'm using Eclipse for my IDE. When I insert controls.tick(forward, back, left, right, turnLeft, turnRight);
("controls" is, well, the controls for my game, and "tick" is the time which ties into steps, turning, time itself, etc.) Eclipse says "The method 'tick'(boolean, boolean, boolean, boolean, boolean) in the type 'Controller' is not applicable for the arguments (boolean, boolean, boolean, boolean, boolean, boolean)"
and I'm beginning to get incredibly frustrated. "forward, back, left, right, turnLeft, turnRight" are booleans designed to, well, be booleans, and prevent the camera from moving. They are "linked" to keys that set it to true, to keep this short. "Controller" is a .class file to "house" the controls, rotations, etc.
So, what's an in-depth response of what I'm doing wrong? It's important I don't add or take away any booleans from what I have. Is there any way around this, and may I have a walkthrough?
Here is my .class file that does the work:
package com.mime.ocelot;
import java.awt.event.KeyEvent;
import com.mime.ocelot.input.Controller;
public class Game {
public int time;
public Controller controls;
public Game() {
}
public void tick(boolean[] key) {
time++;
boolean forward = key[KeyEvent.VK_W];
boolean back = key[KeyEvent.VK_S];
boolean left = key[KeyEvent.VK_A];
boolean right = key[KeyEvent.VK_D];
boolean turnLeft = key[KeyEvent.VK_LEFT];
boolean turnRight = key[KeyEvent.VK_RIGHT];
controls.tick(forward, back, left, right, turnLeft, turnRight);
}
}
And here's the .class that is the actual controller:
package com.mime.ocelot.input;
public class Controller {
public double x, z, rotation, xa, za, rotationa;
public void tick(boolean forward, boolean back, boolean right, boolean turnLeft, boolean turnRight) {
}
}
Upvotes: 0
Views: 3119
Reputation: 1774
tick()
is defined like this:
tick(boolean forward, boolean back, boolean right, boolean turnLeft, boolean turnRight)
It takes five boolean arguments. You call it like this:
tick(forward, back, left, right, turnLeft, turnRight);
You're trying to pass it six boolean
arguments. It looks like you meant to define it like this:
tick(boolean forward, boolean back, boolean left, boolean right, boolean turnLeft, boolean turnRight)
Wow, I got six upvotes for pointing out that a parameter was missing in a function definition.
Upvotes: 7
Reputation: 100
The tick method signature expects 5 booleans, though you are passing 6. Change the tick method to:
public void tick(boolean forward, boolean back, boolean left, boolean right, boolean turnLeft, boolean turnRight)
Upvotes: 1