Precision kicking help!

Okay, I almost have it, but I can’t seem to get it to do the right thing. Can I have some help @Mr-Borges?

Here 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.
loop:
    ball = hero.findNearest(hero.findByType("ball"))
    ballPos = ball.pos
    enemy = hero.findNearestEnemy()
    friends = hero.findFriends()
    friend = hero.findNearest(friends)
    heroPos = hero.pos
    nubPos = enemy.pos
    newVector = Vector.subtract(nubPos, ballPos)
    direction = Vector.normalize(newVector)
    dm = Vector.multiply(direction, -3)
    finalVector = Vector.add(ballPos, dm)
    flag = hero.findFlag("black")
    if flag:
        point1 = {"x": 40, "y": 25}
        hero.command(friend, "move", point1)
        if friend.distanceTo(finalVector) < 2:
            hero.command(friend, "move", finalVector)
        else:
            point2 = {"x": 34, "y": 35}
            hero.command(friend, "move", point2)
            if friend.distanceTo(finalVector) < 2:
                hero.command(friend, "move", finalVector)
            else:
                point3 = {"x": 40, "y": 45}
                hero.command(friend, "move", point3)
                if friend.distanceTo(finalVector) < 2:
                    hero.command(friend, "move", finalVector)
                else:
                    point4 = {"x": 48, "y": 37}
                    hero.command(friend, "move", point4)
                    if friend.distanceTo(finalVector) < 2:
                        hero.command(friend, "move", finalVector)