Commit 349fd016 authored by Monika's avatar Monika
Browse files

set collision racket and ball

parent 04d1199a
......@@ -47,18 +47,13 @@ function ClientCollision(Ball, Racket, User) {
if (
attributes.racket.getIsActive()
&&
//attributes.user.getIsTurn()
//&&
// (ballAxis.x > racketAxis.x && ballAxis.x < racketAxis.x + racketDimension.width) //x coordinate
// &&
// (ballAxis.y < racketAxis.y && ballAxis.y > racketAxis.y - racketDimension.height) //y coordinate
(ballAxis.x >= (racketAxis.x - ballDimension.width))
&&
(ballAxis.x <= (racketAxis.x + ballDimension.width))
(ballAxis.x <= (racketAxis.x + racketDimension.width))
&&
(ballAxis.y >= (racketAxis.y - ballDimension.height))
&&
(ballAxis.y <= (racketAxis.y + ballDimension.height))
(ballAxis.y <= (racketAxis.y + racketDimension.height))
) {
attributes.racket.setIsActive(false);
console.log('collision ball with racket');
......
Markdown is supported
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