learn-gdscript icon indicating copy to clipboard operation
learn-gdscript copied to clipboard

Lesson 7, practice 2: the Turtle position is not reset after the Run

Open lanferna opened this issue 2 years ago • 1 comments

Bug description Even a correct code may poduce an output error "The first square should be drawn at (100, 100)" if any Run cycles were executed before. Looks like the Turtle starts from where she came to during the last Run.

To Reproduce Steps to reproduce the bug:

  1. Go to the Lesson 7, practice 2 ("Draw squares at different positions")
  2. Type a code
func run():
	move_local_x(100)
	move_local_y(100)
	draw_rectangle(100, 100)
	move_local_x(200)
	draw_rectangle(100, 100)
	move_local_x(200)
	draw_rectangle(100, 100)
  1. Press "Run", and all the checks will be OK
  2. Press "Run" again, and the 2nd check will produce an Error

Expected behavior A Run cycle must not depend on previous Runs results

Screenshots gdquest_issue_screenshot-2023-10-01_19-52

Device Info

  • Operating System: Manjaro Linux
  • Browser: Brave

Log file generated Add any other context about the problem here.

gdquest-1696177594050.log

lanferna avatar Oct 01 '23 16:10 lanferna

UPD all works fine with "position.x = 100", so that's my fault in this case. But not resetting variables between Run cycles may produce confusing results somewhere else.

lanferna avatar Oct 01 '23 17:10 lanferna