Using the Pen_down and Pen_up commands in conjunction with moving your Sprite lets you draw connected and unconnected lines. ACTIONS Toolkit - scroll down to DRAWING section for pen commands. Using the grid as a background can be helpful for moving your sprite to the start and end positions of your lines.

# ACTIONS Toolkit - scroll down to DRAWING section stage.set_background("grid") #Add a sprite and position it at the start of the line sprite = codesters.Sprite("codester") sprite.go_to(-100, 100) #Put the pen down sprite.pen_down() #Move the sprite to draw a line ( .go_to or .glide_to sprite.go_to(-100, -100) #draw a connected line by moving the sprite again sprite.glide_to(100, 50) # put the pen up - move - pen down to draw an unconnected line sprite.pen_up() sprite.go_to(100, -100) sprite.pen_down() sprite.go_to(-150, -150)
  • Run Code
  • Show Console
  • Codesters How To (opens in a new tab)