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

Clouddrip Mountain- The Geometry of Flowers

Line 7 of my code here should be correct?

def drawCircle(x, y, size):
    angle = 0
    hero.toggleFlowers(False)
    while angle <= Math.PI * 2:
        newX = x + (size * Math.cos(angle))
        newY = y + (size * Math.sin(angle))
        hero.moveXY(newX, newY)
        hero.toggleFlowers(True)
        angle += 0.2

def drawSquare(x, y, size):
    hero.toggleFlowers(False)
    cornerOffset = size / 2
    hero.moveXY(x - cornerOffset, y - cornerOffset)
    hero.toggleFlowers(True)
    hero.moveXY(x + cornerOffset, y - cornerOffset)
    hero.moveXY(x + cornerOffset, y + cornerOffset)
    hero.moveXY(x - cornerOffset, y + cornerOffset)
    hero.moveXY(x - cornerOffset, y - cornerOffset)


redX = {"x": 28, "y": 36}
whiteX = {"x": 44, "y": 36}

# Pick a color.
hero.setFlowerColor("red")
# Draw a size 10 circle at the redX.
drawCircle(redX, 10)
# Change the color!
hero.setFlowerColor("random")
# Draw a size 10 square at the whiteX.
drawSquare(whiteX, 10)

Isn’t line 7 here the initial code in the level? Why the duck kept saying I gave a string in moveXY? It should be a number there…

In lines 28 and 32, you are passing the string variable redX (or whiteX) to their respective draw definition. The definition is actually expecting numeric values, not a string.