Всякий раз, когда квадрат сталкивается с кругом (в любом направлении: север, юг, восток или запад), мой код должен увеличить счет на единицу, но он не обнаруживает столкновения. Я уверен, что функция вызывается, и у функции, похоже, нет ошибок. В чем проблема?
function collisionPoint()
{
if (playerRight == pointX && playerLeft == pointX - playerWidth && playerTop > pointTop - playerHeight && playerBottom < pointBottom + playerWidth)
{
score++;
}
if (playerLeft == pointX && playerRight == pointX + playerWidth && playerTop > pointTop - playerHeight && playerBottom < pointBottom + playerWidth)
{
score++;
}
if (playerTop == pointY && playerBottom == pointY - playerHeight && playerRight < pointRight + playerWidth && playerLeft > pointLeft + playerWidth)
{
score++;
}
if (playerBottom == pointY && playerTop == pointY + playerHeight && playerRight < pointRight + playerWidth && playerLeft > pointLeft + playerWidth)
{
score++;
}
}