Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Precision Kicking Level help(python)

Hi I am stuck on this level so far this is my code

# Push the ball to knock over all the blue skeletons without hitting any red ones.
# The blue skeletons can be found as enemies.
TargetSkeletons = []
skeletons = hero.findByType("skeleton")
ball = hero.findNearest(hero.findByType("ball"))
friend1 = hero.findFriends()[0]
for skeleton in skeletons:
    if skeleton.team == "ogres":
        TargetSkeletons.append(skeleton)
    else:
        continue
def whereToGo(target,friend):
    line = Vector.subtract(target.pos, ball.pos)
    Position = Vector.add(line, 5)
    hero.command(friend, "move", Position)
TargetSkeleton = TargetSkeletons[0]
whereToGo(TargetSkeleton, friend1)

this is the link for the level
I says that there is a problem with my command:move
right now I am just trying to knock down the first skeleton in my array

I don’t know, maybe you should try switching

to

line = Vector.subtract(ball.pos, target.pos)

I had the same problem with the griffin bombers level.

thank you, I will try

It doesn’t work because it says:
Line 15: ArgumentError: Target an {x:number, y:number} position