I'm in the process of creating a simple game and I stumbled upon an error I can't resolve. When trying to import/draw an image with Graphics an error pops up:
Multiple markers at this line
- getCenterX cannot be resolved or is not a field
- getCenterY cannot be resolved or is not a field
- getCenterY cannot be resolved or is not a field
I'm most certain that I imported everything correctly:
Declarations/Variables/Definitions
// In the class "StartingClass"
private Robot robot;
private URL base;
// In the class "Robot"
private int centerX = 100;
private int centerY = 328;
Methods in the class "StartingClass"
@Override
public void paint(Graphics g) {
g.drawImage(character, robot.getCenterX()- 61, robot.getCenterY - 62, this);
}
@Override
public void start() {
robot = new Robot();
}
Methods in the class "Robot"
public int getCenterX() {
return centerX;
}
public int getCenterY() {
return centerY;
}