[Week 2] Introducing State


Today, we will cover the PyGame loop again and step through in class how to make things move. This requires understanding how to represent state.

We will practice using functions today, so that we can avoid messiness, enable reusability, and improve the readability. This will require understanding scope, encapsulation, and polymorphism (which is a fancy word for code being able to be used in multiple ways).

The first projects are also selected today. They will require the following:

  1. a moving object through changing the position state
  2. interaction through the event loop that changes a property of the state
  3. a demonstration of reusable code with functions


  1. Come up with a project
    • see slides for a couple ideas
  2. Put the out of bounds checker into a function

  3. Make a wall and have the objects bounce off of it