American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

FRI – 7 PM – Python Game Development – Joel

March 7 @ 7:00 pm - 8:00 pm

Today we did:
  1. We worked on the cloud timer and started doing the animation.
Homework:
  1. The animation works perfectly, but we need to slow it down.
  2. Similar to the way we created spawn timers for bird and cloud, here’s how you can set a timer to control how fast or slow the animation is:
    1. Create a new constant in the config.py called FLAP_DELAY. You can set this to any time you want, but I will recommend around 10.
    2. Remember, the code we did today changes the image from A to B, A to B, and so on. We need to make sure that this code is only happening if the timer == 0.
    3. Create a self.flap_timer in the constructor for the Bird class.
    4. Similar to the cloud and bird spawn timer, you need to -= 1 for the timer, and once it hits 0, only then should you put the code for switching images.
    5. Regardless, you should still take the image = self.image_list[self.img_index] and return it outside of the if statement. This will make sure that even if the timer is not 0, and the image doesn’t change, you are still taking an image to blit in the update.
    6. Don’t forget your homework into your branch before next week.

If you have any questions, feel free to email me at joel@ayclogic.com.

Details

Date:
March 7
Time:
7:00 pm - 8:00 pm
Verified by MonsterInsights