//collidesWall() checks if a collision has happened with a wall or not.
//It also checks and returns if a goal has happened.
//index -1 means no collision
// 1 means collision with left wall
// 2 right wall
// 3 upper wall
// 4 means lower wall
collidesWall() checks if a collision has happened with a wall or not.
It also checks and returns if a goal has happened.
index -1 means no collision
1 means collision with left wall
2 right wall
3 upper wall
4 means lower wall
// collidesWall () checks if a collision has happened with a wall or not . // It also checks and returns if a goal has happened . // index - 1 means no collision // 1 means collision with left wall // 2 right wall // 3 upper wall // 4 means lower wall
func (ball *Ball) collidesWall() (goal int, index int) {
	if ball.X < boundarywidth+radius && ball.Xv < 0 {
		if ball.Y <= 297-radius && ball.Y >= 201+radius {
			insideGoal = true
			return 2, -1
		}
		return 0, 1
	} else if ball.X > BoxWidth-boundarywidth-radius-1 && ball.Xv > 0 {
		if ball.Y <= 297-radius && ball.Y >= 201+radius {
			insideGoal = true
			return 1, -1
		}
		return 0, 2
	} else if ball.Y < boundarywidth+radius && ball.Yv < 0 {
		return 0, 3
	} else if ball.Y > BoxHeight-boundarywidth-radius-1 && ball.Yv > 0 {
		return 0, 4
	}
	return 0, -1
}
func ( ball * Ball ) collidesWall ( ) ( goal int , index int ) { if ball . X < boundarywidth + radius && ball . Xv < 0 { if ball . Y <= 297 - radius && ball . Y >= 201 + radius { insideGoal = true return 2 , - 1 } return 0 , 1 } else if ball . X > BoxWidth - boundarywidth - radius - 1 && ball . Xv > 0 { if ball . Y <= 297 - radius && ball . Y >= 201 + radius { insideGoal = true return 1 , - 1 } return 0 , 2 } else if ball . Y < boundarywidth + radius && ball . Yv < 0 { return 0 , 3 } else if ball . Y > BoxHeight - boundarywidth - radius - 1 && ball . Yv > 0 { return 0 , 4 } return 0 , - 1 }
collidesWall() checks if a collision has happened with a wall or not.
collidesWall () checks if a collision has happened with a wall or not .