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

Animate the turtle turning #5

Closed NathanLovato closed 2 years ago

NathanLovato commented 2 years ago

Calls to turn_right() or turn_left() work but don’t make the turtle turn visually. Animating the turn on generated vertices would make it easier for students to understand what the function does (the turtle virtually turns in place but does not draw anything).

With this change, when the turtle reaches a vertex, it would turn in-place based on calls to turn_right() and turn_left().

For an example of the issue, see the runnable example in lesson 5 that only draws one line.

duianto commented 2 years ago

Just noticed the issue in Lesson 5, that the turtle doesn't turn visually.


Update: The comments below about the icon, are now obsolete based on the discussion thread: Make the turtle an actual turtle #142 https://github.com/GDQuest/learn-gdscript/discussions/142#discussioncomment-1958273

Sure, the current icon is a placeholder


~It might also be helpful to modify or replace the turtle icon. So that it indicates a direction.~

~In some tutorials that actually use a turtle, the head indicates in which direction it will move when more_forward() is called.~

~Or if the greater than symbol to the left, on the icon, indicates that it moves forward to the right. Then it would be better to fill in the middle of the icon with a solid color.~

~Currently the center is a hole to the background.~

~The 1 is visible behind the icon, which makes it more difficult to see which way it's pointing.~

msedge_ZXXKm9ZdG7

NathanLovato commented 2 years ago

Implementation notes: we need to move the animation code out of the polygon class.

We should preserve the polygon data for assignment checks, but should separate animation entirely. Instead of using the polygon data, we can keep a buffer of commands sent by the user (move forward, turn, ...) and animate based on that. Each command would lead to a separate tween animation, allowing us to animate turning even when there's no move_forward() or other call afterwards.