So I wanted to make a 'Ball' class that extends a 'Thing' class. I call the super command for variables that are shared (ex. x,y,sizeX) in the constructor. But when I try to use them (specifically in the jump function) it gives me the error 'MeTryingToMakeAGame.Thing.x is not visible'
Please note that the name of my project is 'MeTryingToMakeAGame.'
class Ball extends Thing {
Ball(int x, int y, int sizeX, int sizeY, int speed, int jumpheight) {
super(x,y,sizeX,sizeY);
}
void jump() {
x-=jumpHeight;
}
}
class Thing {
private int x;
private int y;
private int sizeX;
private int sizeY;
Thing (int x, int y, int sizeX, int sizeY) {
this.x = x;
this.y = y;
this.sizeX = sizeX;
this.sizeY = sizeY;
}
}