CMPT 166 Lecture Notes - Lecture 29: Turtle Graphics, Object-Oriented Programming, Decagon

70 views7 pages

Document Summary

In these notes you will learn: how to draw shapes using turtle graphics, how to implement a turtle class for drawing turtle graphics. Turtle graphics is a simple yet useful approach to drawing pictures. As it moves, the turtle draws a line showing it"s path. So, for example, these commands would make the turtle draw a square: pen down. Forward 10: turn right 90 degrees, turn right 90 degrees, turn right 90 degrees, turn right 90 degrees. Turtle graphics is easy enough for young children to understand. It only has a few simple commands, and with a bit of experimentation you can draw some very interesting pictures. Processing doesn"t come with turtle graphics built-in, so lets add it ourselves. In an object- oriented language like processing, the natural approach is to create a class called turtle that represents an on-screen turtle. When it"s done, it should work like this:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents