WDI-SEA / game-project-issues

0 stars 0 forks source link

collision detection #54

Open galyverasi opened 2 years ago

galyverasi commented 2 years ago

What's the problem you're trying to solve?

collision detection is still not perfect for the left paddle

Post any code you think might be relevant (one fenced block per file)

function leftPaddleHit() {
    if (ball.x - ball.size < leftPaddle.x + leftPaddle.width &&
        ball.y - ball.size > leftPaddle.y &&
        ball.y + ball.size < leftPaddle.y + leftPaddle.height
    ) { moveRight()
        console.log("hit left paddle")
    }
}

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

What is your best guess as to the source of the problem?

What things have you already tried to solve the problem?

Starting all over and trying different ways for this collision to be detected

DoireannJane commented 2 years ago

We altered the if statement in Galyver's increaseScore function so detecting hit on left paddle no longer increases points. Top of canvas hits are increasing score. We will take another look soon.

TaylorDarneille commented 2 years ago

I'm checking collision detection now. if it's not that, going to Ping Timm to look at how the canvas is drawn.