[SOLVED]The Geometry of Flowers (python)(help)

this is my code:

# You now have the Ring of Flowers! You can do:
# toggleFlowers(True/False) - turns flowers on or off.
# setFlowerColor("random") - can also be "pink", "red", "blue", "purple", "yellow", or "white".

# Here are some functions for drawing shapes:
# x, y - center of the shape
# size - size of the shape (radius, side length)
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("blue")
# Draw a size 10 square at the whiteX.
drawSquare(whiteX,10)
# Now experiment with drawing whatever you want!

It says it has an error in this line hero.moveXY(newX, newY) it says i cannot do this. i have to put a number. Help plz.

you also have to draw what it says on the bottom

I will try that (20)

Still has
image

yeah I know I just saw that too
(It happened to me too)

The drawCircle and drawSquare lines should have coordinates, so your drawCircle should be drawCircle(28,36,10), then you should figure out the drawSquare coordinates.

wait so you just have to type in the numbers?
I did that but isnt that “cheating” the level?

I don’t think so, or maybe you have to do redX.pos.x and redX.pos.y. In the function there is (x,y,size).

1 Like

maybe(2000000000=-0)

Works with numbers(2000)Thanks abc

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.