American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

1 PM – Python Game Development

January 30, 2021 @ 1:00 pm - 2:00 pm

  • We went over the homework to add the “create_bird” method which spawns a lot of birds.
  • We reviewed the Bird sprite.
  • We moved the constants into a new file called “config.py” and refactored the code to import the constants from this new file
  • We went over a strategy to delay the creation of birds, and then implemented this strategy which creates a new bird once every 40 frames.
  • We added some logic to select a random name from the 4 different types of birds rather than just using the blue bird.
  • I’ve uploaded the source code here.
  •  Homework
    • Edit the Bird Sprite class to have a new attribute “speed” which keeps track of how fast the bird is moving.  Initialize this to a random value between 1 and 7 (so every Bird should be 1 or 7 or something in between).
    • Modify the “def update” method inside the Bird class to increase the self.x attribute by the speed.

Details

Date:
January 30, 2021
Time:
1:00 pm - 2:00 pm
Event Categories:
,