I was trying Geometry of Flowers and I did everything it told me to
The problem the game is having is with the code that was originally there
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
was given
The line it doesn’t like is hero.moveXY(newX, newY)
I am having the same problem as you. I look on others and they had different problems.
guy_oy
November 3, 2019, 4:31pm
3
I’m having that problem did you ever figure it out?
R_Ross
July 14, 2021, 7:34am
4
same
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
R_Ross
July 14, 2021, 6:28pm
5
@Hydrobolic @Chaboi_3000 could you help here? you must have passed this level before, how?
I have had no difficulties solving this level. Does your equipment provide hero.moveXY()
method? Do you have a more specific error?
R_Ross
July 14, 2021, 8:47pm
7
As you can see, the game’s given code has a error. Are you using this code? do you have gear that lets you use variables/strings in moveXY?
@Hydrobolic
R_Ross
July 14, 2021, 8:54pm
8
(The code that has an error was given by the game, here’s a photo of the code right after resetting the code, with an error)
![image|690x227](upload://sw@Hydrobolic bxyJPEGZCealpO.jpeg)
@hydrobolic
R_Ross
July 14, 2021, 8:54pm
9
error with the last photo lol
You are experiencing the effects of JavaScript in Python, a side effect of CodeCombat’s not quite correct parser.
Note how the drawCircle
function is defined to take an x
and y
coordinates in addition to the size, but you are passing a {x: ..., y: ...}
position instead. As a result, inside the function, x
is a position, y
is 10, and size
is undefined, none of which are right.
You’ll need to pass the x
and y
coordinates individually or change the function defintion.
drawCircle(redX.x, redX.y, 10)
R_Ross
July 14, 2021, 8:57pm
11
ok thanks Preformatted text
R_Ross
July 14, 2021, 8:58pm
12
drawCircle(redX.pos.x, redX.pos.y, 10)
it now says cannot read property ‘x’ of undefined
{x: ..., y: ...}
only has x
and y
attributes
R_Ross
July 14, 2021, 8:59pm
14
oh im stupid sorry Preformatted text
R_Ross
July 14, 2021, 9:03pm
15
This is now officially solved