//CheckCollision() checks at every frame if a collision has happened with a player or not.
//If a collision has happened, it invokes onCollisionwithPlayer().
CheckCollision() checks at every frame if a collision has happened with a player or not.
If a collision has happened, it invokes onCollisionwithPlayer().
// CheckCollision () checks at every frame if a collision has happened with a player or not . // If a collision has happened it invokes onCollisionwithPlayer () .
func (ball *ball) CheckCollision(t team, teamid int32) {
	c1 := make(chan int)
	go ball.NearestObstacle(c1)
	arr := [2][]int{{0, 1, 3, 5}, {7, 6, 4, 2}}
	var stick [4][]player
	stick[0] = t.GoalKeeper[0:1]
	stick[1] = t.Defence[0:2]
	stick[2] = t.Mid[0:5]
	stick[3] = t.Attack[0:3]
	index := <-c1
	for i, j := range arr[teamid-1] {
		if j == index {
			for k := range stick[i] {
				go ball.Collision(t, teamid, stick[i][k])
			}
		}
	}
}
func ( ball * ball ) CheckCollision ( t team , teamid int32 ) { c1 := make ( chan int ) go ball . NearestObstacle ( c1 ) arr := [ 2 ] [ ] int { { 0 , 1 , 3 , 5 } , { 7 , 6 , 4 , 2 } } var stick [ 4 ] [ ] player stick [ 0 ] = t . GoalKeeper [ 0 : 1 ] stick [ 1 ] = t . Defence [ 0 : 2 ] stick [ 2 ] = t . Mid [ 0 : 5 ] stick [ 3 ] = t . Attack [ 0 : 3 ] index := <- c1 for i , j := range arr [ teamid - 1 ] { if j == index { for k := range stick [ i ] { go ball . Collision ( t , teamid , stick [ i ] [ k ] ) } } } }
CheckCollision() checks at every frame if a collision has happened with a player or not.
CheckCollision () checks at every frame if a collision has happened with a player or not .