Here is an embedded link to my trinket:
Milestones:
• Select colors based off of key selection • Select area to choose line drawing • Select area to choose circle drawing • Select area to choose square drawing • Have text appear to show user what to press and how to draw • Have key available to clear content of screen • Mode must be displayed • Logic behind having different modes execute (display mode when selected) • Use for loop to draw squares • Make line white to draw different lines
I began this assignment by making a bulleted list of my milestones and jotting down potential code to help achieve them. When reading the assignment before brainstorming, this task seemed incredibly intimidating and I struggled to find where to begin for a few days. After creating the window that contained the instructions for the program first and beginning to code my milestones, the program began to form itself. I got into the zone and knocked out the program’s user interface, the key color options, and the user’s ability to drag and draw a line within the first 3 or so hours of coding.
After working through the kinks of this first portion of code (making separate turtles really helped smooth out some bugs – this took me a significant amount of time to learn via trial and error), I began working on a way to make the user press a key to toggle between drawing circles, squares, and lines. Finding a way to have the program process the key input and then allow the ‘onclick’ command to tell the program where to place the circle caused a significant hiccup and delay in my work. Overall, I’ve spent the most time working on how to make it so that the user can change between drawing a circle, square, or line.
Eventually, I figured out how to do this and was able to fiddle with my code enough to make it so that the user could actually switch between circles, lines, and squares in different colors, while also showing the mode and color that the turtle is. At first, I wasn’t setting logic to tell the turtle where it could and couldn’t draw, and where clicking changed the manner in which it should act. I was initially trying to make separate turtles for this action, but realized that it was much easier using this logic all with the same turtle.