Variables comparison

Good evening everyone, I have to control motors according to a x,y position of an object which is relevated by a camera then the camera sends to my arduino programm the x,y variables. As these two variables change every cycle and I need to compare them in order to know if I have to move the motor forward or backward, how can I memorize the values of x,y in cycle 1 and then compare it with the new values x,y in cycle 2? Should I memorize them in the EEPROM at every cycle and then compare them?

Thank you for your help in advance

Before you take the cycle2 readings, just save the previous ones into two more variables

xOld =x;
yOld=y;
//then get the new x and y how ever that happens
//and compare:
if (x>xOld)
{
//whatever
}
else
{
//whatever
}
//same for y

manor_royal: Before you take the cycle2 readings, just save the previous ones into two more variables

twice the global variables?

some pseudo code...

int newX = getSomeValueForX();
int newY = getSomeValueForY();

if(oldX isDifferentFrom newX)
{
  //do something
  oldX = newX;
}


if(oldY isDifferentFrom newY)
{
  //do something
  oldY = newY;
}

// do more stuff