# 5: Interactive Turtles

## Expectations

### Learning Targets <a href="#learning-targets" id="learning-targets"></a>

* I can interpret an unfamiliar code base.
* I can extend the code to my own project.

### Assessments <a href="#assessments" id="assessments"></a>

* You will create an interactive program or game based on existing turtle classes
* You will be asked regular comprehension questions about Python.

## First Class Assignment (CodeHS.com)

{% embed url="<https://youtu.be/iS-hSCRfgtY>" %}

## Adding Moving Turtle

{% embed url="<https://youtu.be/4kb7QIywRb4>" %}

```
from turtle import Turtle


class ClassName (Turtle):
    def __init__(self, starting_x, starting_y):
        Turtle.__init__(self)
        self.starting_x = starting_x
        self.starting_y = starting_y
        
        # General setup
        # self.color("black")
        # self.penup()
        # self.shape("turtle")
        # self.goto(self.starting_x, self.starting_y)
        
    def method_example(self):
        pass
        ## change the name and make the method work
```

## Assignment and Rubric

Create an interactive turtle application of your own design. This can be a game or other interactive program, but it must use at least two of the three types of turtle classes we have outlined (moving turtle, keyboard turtle, clickable turtle).

* **3 pts** - Program works without errors
* **3pts** - Program uses two classes of turtle
* **3pts** - Program is interactive. Users can DO something with the program beyond what we set up in class. Make sure your theme is cohesive!
* **1pts** - Program is cleaned up (unused imports have been deleted, for example)

##

## How do I...

### ...make multiple things move?

{% embed url="<https://youtu.be/_n3qJklHjR8>" %}

### ...write text on the screen?

{% embed url="<https://youtu.be/1vwIShtQr-U>" %}

### ...stop movement with walls?

{% embed url="<https://youtu.be/uJREYW7L3WQ>" %}

### ...make a ball move diagonally and bounce off multiple sides of the room?

{% embed url="<https://youtu.be/pEJSQ8Y-VmY>" %}

### ... create a background image and have it change later?

{% embed url="<https://youtu.be/7YTAWsqzDlY>" %}

### ...set up and check a timer

{% embed url="<https://youtu.be/14gEXdWfm1s>" %}

### ...add a start screen

{% embed url="<https://youtu.be/tZvX66v9HmI>" %}

### ...Save a High Score in a File?

{% embed url="<https://youtu.be/3RpRahCFDtQ>" %}

### ... add points from different objects to a single score?

{% embed url="<https://youtu.be/5TWzrfUStPA>" %}

### ... get objects to check each other for different properties?

{% embed url="<https://youtu.be/IosOxvRuYCE>" %}

### **...find the x and y position of my mouse on the screen?**

{% embed url="<https://youtu.be/z8R_5ZO9Afk>" %}

### ...create a custom shaped turtle?

{% embed url="<https://youtu.be/lIVaHIGlMVg>" %}

### ...create a multi-colored turtle?

{% embed url="<https://youtu.be/kbb1bNj0CEE>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gilmour.online/compsci/pnr/5-replit-github-and-repositories-oh-my.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
