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})
my code seems fine but it still says
while True:
friends = self.findFriends()
ball=self.findByType("ball")
for friend in friends:
self.command(friend, "move", {"x":15,"y":ball.pos.y})
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…
ok (20000000000000000000)
@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.
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.