i want to move an object to specific koordinates but i dont want to type high numbers like 300 for x and y so i gave them numbers from 1-7
x and y are the int numbers the player has to give (1-7)
but it says that X and Y might not have been initialized
int XO =this.getX();
int YO = this.getY();
int eingX = x;
int eingY = y;
int X;
int Y;
if(x == 1)
{
X = 30;
}
if(x == 2)
{
X = 150;
}
if(x == 3)
{
X = 270;
}
if(x == 4)
{
X = 400;
}
if(x == 5)
{
X = 520;
}
if(x == 6)
{
X = 645;
}
if(x == 7)
{
X = 775;
}
if(y == 1)
{
Y = 30;
}
if(y == 2)
{
Y = 150;
}
if(y == 3)
{
Y = 270;
}
if(y == 4)
{
Y = 400;
}
if(y == 5)
{
Y = 520;
}
if(y == 6)
{
Y = 645;
}
if(y == 7)
{
Y = 775;
}
if(x!=1 && x!=2 && x!=3 && x!=4 && x!=5 && x!=6 && x!=7)
{
X = XO;
}
setLocation(X,Y);
