GDQuest / learn-gdscript

Learn Godot's GDScript programming language from zero, right in your browser, for free.
https://gdquest.github.io/learn-gdscript/
Other
2.11k stars 160 forks source link

Lesson 4: using rotate() in "Drawing a corner" test glitches out the turtle #471

Closed theMotionblur closed 2 years ago

theMotionblur commented 2 years ago

Describe the bug Using rotate() in the "Drawing a corner" test glitches out the turtle, even before it hits the rotate() function The lines drawn before the code hits rotate() aren't straight any more.

To Reproduce Enter the following code into the playground console https://gdquest.github.io/learn-gdscript/#course/lesson-4-drawing-a-rectangle/practice-Gx0c7DDi.tres

func draw_corner():
    move_forward(150)
    turn_right(60)
    move_forward(150)
    turn_right(60)
    move_forward(150)
    turn_right(60)
    move_forward(150)
    turn_right(60)
    move_forward(150)
    turn_right(60)
    move_forward(150)
    turn_right(60)
    rotate(45)
    move_forward(200)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots grafik

When omiting the rotate() function it actually works as expected grafik

Information about your device (please complete the following information): Windows 11 Home Mozilla Firefox 98.0.2

NathanLovato commented 2 years ago

That's normal, you shouldn't rotate the turtle. As mentioned in the practice, you need to use its functions turn_right and turn_left

theMotionblur commented 2 years ago

PLease try the actual code in the demo console. I mean - I am aware that this is not the expected solution to the question. What baffles me is that in that example the turtle slides diagonally and produces slightly diagonal lines even before the code hits the rotate() statement.

NathanLovato commented 2 years ago

Yes but again, that's normal. The turtle doesn't support the rotate() function or changing its rotation property. I know that it's behaving like that and why, but it's intentional.

You have to use the turtle's API.

image

I see the documentation is not appearing in the corner exercise though, I'll fix this right away.