//onCollisionWithWall() changes the direction and speed of the ball.
onCollisionWithWall() changes the direction and speed of the ball.
// onCollisionWithWall () changes the direction and speed of the ball .
func OnCollisionWithWall(ball *ball, index int) {
	if index == 1 || index == 2 {
		ball.Xv = -ball.Xv
	} else if index == 3 || index == 4 {
		ball.Yv = -ball.Yv
	}
	if math.Abs(ball.Xv) > BallSpeedX {
		ball.Xv /= 2
		ball.Yv = BallSpeedY * (ball.Yv / math.Abs(ball.Yv))
	}
}
func OnCollisionWithWall ( ball * ball , index int ) { if index == 1 || index == 2 { ball . Xv = - ball . Xv } else if index == 3 || index == 4 { ball . Yv = - ball . Yv } if math . Abs ( ball . Xv ) > BallSpeedX { ball . Xv /= 2 ball . Yv = BallSpeedY * ( ball . Yv / math . Abs ( ball . Yv ) ) } }
onCollisionWithWall() changes the direction and speed of the ball.
onCollisionWithWall () changes the direction and speed of the ball .