We welcome opinions here on CodeCombat, but if you could please refrain from openly insulting the levels without a shown reason, that would be nice.
The startAngle
is incorrect. (Itâs close though!)
Did you do this through trial and error? Because the start angle can be computed geometrically: A regular hexagon can be divided into six equilateral triangles; draw a perpendicular bisector from the center to the side of one of the triangles, you get two 30-60-90 triangles, and you should be able to determine the start angle from that.
footnote
Then again, I wouldnât expect many kids to know these things until maybe around ages 12â15.
Hey Guys⌠For me as a german, its hard to find out what to do on this level, because i kinda have to google all things that were shown to me. A complete German explanation would be nice, cause in the beginning i even do not know what a bib is.
the only thing i can do is copying the code outa here, because i cant find out what to doâŚ
This one ended up being pretty hard due to the amount of stuff you have to read in the guide. Iâm going to make it part of the premium level flow to make it more clear that itâs an optional side level (it doesnât unlock anything). Might want to skip this one until someone has the time to help translate that.
I have reproduced the screenshot in the instructions exactly yet the level doesnât complete. What gives?
Your box doesnât appear to be the same. It should be centered on the X, and all the sides should be the same length.
This is the image from the instructions:
Mine is centered the same way it is in the image. I adjusted the legs to be the same length as the angled sides and it still doesnât complete.
Hm. In that case, letâs see your code. There might be something in there.
I resized and copied your solution on top of the expected solution found in the guide:
As you see, your square is not correct: it should be a bit more âsquashedâ â the top square should be diamond shaped, not a right-angled square. In fact, the outline of the 3D square should be a perfect hexagon, with equal sides, centered at the red X.
The bib is also a bit off: it should touch the top of the star , while yours is a bit shifted downwards â try to move it up 1-2 steps.
Cheers
hi,
Can you show me your code in Python ? Iâm stuck in this for days.
hi,
Can you show me your code in Python ? Iâm stuck in this for days.Thanks
Dear @kevin, and everyone else stuck on this level,
We donât publish solutions on the forum â that would be against the idea of the game.
The level itself is not really difficult, as the drawing functions are provided by default, so you only need to call them with the correct parameters. Most of these parameters are given in the comments.
###Box
# Draw a "3D style" box ... centered on the red X ... with a size of 10.
# ...
# ...If you think in degrees then use the "degreesToRadians(degrees)" function...
drawPolygon(center, size, number of sides, start angle)
drawSpokes(center, size, number of spokes, start angle) # same as above
Letâs see the parameters:
- center: given
- size: given
- sides: given (count them)
- spokes: given (count them)
- start angle: try and/or guess (hint: think of a clock, and the angle between the numbers)
###Bib
# Draw the star bib...
# ...centered on the white X ... size of 6.
# ...spirals have a size of 15 ... to go the other direction give a negative number of loops.
#setFlowerColor
drawStar(center, size, sides, skips, startAngle)
#setFlowerColor
drawSpiral(center, size, number of loops, start angle)
drawSpiral(center, size, number of loops, start angle)
Letâs see the parameters:
- center: given for the star; for the spirals, there is a few steps offset
- size: given
- sides: given (count them) (hint: think of âsidesâ as spikes or vertices)
- skips: experiment a little (hint: try positive integers)
- loops: given (count them)
- start angle: try and/or guess (use a similar approach as for the box)
For even more help, click the below image:
Please this post if you found it useful. Thanks!
Thank you for the explanation, it looks easier now.
But still, I am stuck at the first box.
I tried many angles but it still donât understand how to calculate it.
hero.setFlowerColor("white")
drawPolygon(redX, 10, 6, 0.45 )
drawSpokes(redX, 10, 3, 0.45 )
Has anyone an example of a form with an angle and how did you find it ?
Thank you,
Eliot
drawPolygon(redX, 10, 6, 0.45 )
âŚand what is the 0.45
starting angle? If youâre thinking in radians, thatâs not âroundâ (see below) - you better try something like pi/2, pi/3, etc. If youâre thinking in degrees, thatâs way too small. If you were thinking to about 45 degrees, well, then do so, but donât forget to convert it as noted in the comments:
# ...If you think in degrees then use the "degreesToRadians(degrees)" function...
I hope this helps.
little reminder:
- full circle = 2 * pi (= 6.28) radians = 360 degrees
- half circle = pi rad = 180 deg
- quarter circle = pi / 2 rad = 90 deg
- etc
thus:
- 0.45 rad = 25.78 deg = 1/14th of a circle
- 0.45 deg = 0.0078 rad = 1/800th of a circle
- 45 deg = pi / 4 rad = 1/8th of a circle
- etc
It makes me remember bad memories from primary schoolâŚ
Anyway, thank you ant !
I passed the level with success.
Eliot