I'm still having difficults writting the collision code for my breakout clone. The right side isn't colliding.
left
Code:
if(ball.x+ball.width >= blocks[x][y].x &&
ball.x+ball.width <= blocks[x][y].x+blocks[x][y].width/2 &&
ball.y > blocks[x][y].y &&
ball.y <= blocks[x][y].y+blocks[x][y].height)
ball.dx = -ball.dx;
right
Code:
if(ball.x+ball.width >= blocks[x][y].x+blocks[x][y].width/2 &&
ball.x <= blocks[x][y].x+blocks[x][y].width &&
ball.y > blocks[x][y].y &&
ball.y <= blocks[x][y].y+blocks[x][y].height)
ball.dx = ball.dx;