Hi all
I was given a piece of code for my assignment, i understand most of it, apart from this section, could someone please explain it too me?
Its a pacman style game, with the coloured fish being the enemies.
I can post more code if needed
Code:
if ((REDFISH.GetPositionX() < (PLAYER.GetPositionX() + 10)) && (REDFISH.GetPositionX() > PLAYER.GetPositionX()) && (REDFISH.GetPositionY() < (PLAYER.GetPositionY() + 0.2)) && (REDFISH.GetPositionY() > (PLAYER.GetPositionY() - 0.2))) {
redfishmove = 0;
}
if ((REDFISH.GetPositionX() > (PLAYER.GetPositionX() - 10)) && (REDFISH.GetPositionX() < PLAYER.GetPositionX()) && (REDFISH.GetPositionY() < (PLAYER.GetPositionY() + 0.2)) && (REDFISH.GetPositionY() > (PLAYER.GetPositionY() - 0.2))) {
redfishmove = 1;
}
if ((REDFISH.GetPositionY() > (PLAYER.GetPositionY() - 10)) && (REDFISH.GetPositionY() < PLAYER.GetPositionY()) && (REDFISH.GetPositionX() < (PLAYER.GetPositionX() + 0.2)) && (REDFISH.GetPositionX() > (PLAYER.GetPositionX() - 0.2))) {
redfishmove = 2;
}
if ((REDFISH.GetPositionY() < (PLAYER.GetPositionY() + 10)) && (REDFISH.GetPositionY() > PLAYER.GetPositionY()) && (REDFISH.GetPositionX() < (PLAYER.GetPositionX() + 0.2)) && (REDFISH.GetPositionX() > (PLAYER.GetPositionX() - 0.2))) {
redfishmove = 3;
}