I'm making an archery game and I need to shoot 5 arrows and assign a point value to each spot of the target. Bulls eye is worth 9 and each ring out from there is worth 2 less. I am having trouble figuring out how to assign a score to the target. I'm writing it in the getScore function to be called later on by main. Any advice?

Thanks! Here's part of my code

def drawTarget(win):
    center = Point(0,0)  # Center of target
    e = Circle(center,5) # largest circle
    d = Circle(center,4)
    c = Circle(center,3)
    b = Circle(center,2)
    a = Circle(center,1) # smallest (bullseye) circle

# allow user to place an arrow shot with the mouse and return the score associated
# with that show.  Place a small circle to show where the arrow hit.
def getScore(win):

    x = win.getMouse()
    c = Circle(x,.1)

    p1 = x.getX()
    p2 = x.getY()

    #score = math.sqrt((p1)**2),p2**2)

    return 0 # needs to be replaced by real score

Recommended Answers

All 4 Replies

It might be worthwhile pointing out which of the many possible GUI modules you are using.

I think it looks like GraphWin.. but my GUI Knowledge is limited.

It was GraphWin sorry! I got it all figured out though, just had to figure out the distance from the center and return the score assigned to that circle. Thanks for responding everyone

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.