GoalKeeper Bugs?

my code seems fine but it still says


my code

while True:
    
    friends = self.findFriends()
    ball=self.findByType("ball")
    for friend in friends:
        self.command(friend, "move", {"x":15,"y":ball.pos.y})

1 Like

This returns an array of all the balls.

You can’t move to an array’s pos.y so maybe you should use something else instead of ball…

2 Likes

ok (20000000000000000000)

1 Like

@Jake_Doggy,
As @MidnightWolf39 stated, findByType() returns an array/list of objects, not a single object. In order to get the nearest ball, you should use the findNearest() function to get the nearest object in that array/list. For example, I would do nearestGriffinRider = hero.findNearest(findByType("griffin-rider")). So try applying that to the ball object.

4 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.