Commit eedc47b8 authored by QuentiumYT's avatar QuentiumYT
Browse files

Variation ball hit angle

parent 3b3679fa
......@@ -148,7 +148,10 @@ setInterval(() => {
ball.y - ball.r + ball.vy <= player.y + player.h &&
ball.y - ball.r + ball.vy > player.y)
) {
ball.a = 360 - ball.a;
let variation =
(ball.x - player.w / 2 - player.x) *
(30 / player.w);
ball.a = 360 - ball.a + variation;
}
}
}
......@@ -166,7 +169,10 @@ setInterval(() => {
ball.x - ball.r + ball.vx <= player.x + player.w &&
ball.x - ball.r + ball.vx > player.x)
) {
ball.a = 180 - ball.a;
let variation =
(ball.y - player.h / 2 - player.y) *
(30 / player.h);
ball.a = 180 - ball.a + variation;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment