Код: Выделить всё
if (det.locationY < 135 && det.locationX < 210) {
det.speedX = 0;
det.speedY = 1;
}
else if (det.locationY >= 135 && det.locationY < 138 && det.locationX < 702) {
det.speedX = 1;
det.speedY = 0;
}
else if (det.locationX >= 702 && det.locationY < 260) {
det.speedX = 0;
det.speedY = 1;
}
else if (det.locationY >= 260 && det.locationX > 268) {
det.speedX = -1;
det.speedY = 0;
}
else if (det.locationX = 448 && det.locationY = 827 && det.locationY < 670) {
det.speedX = 0;
det.speedY = 1;
}
else if (det.locationY >= 670 && det.locationX < 763) {
det.speedX = 1;
det.speedY = 0;
}
else if (det.locationX >= 763 && det.locationY < 696) {
det.speedX = 0;
det.speedY = 1;
}< /code>
< /div>
< /div>
< /p>
enter code here
Подробнее здесь: https://stackoverflow.com/questions/796 ... ment-logic