American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

5 PM – Python Game Development – Darin

February 26 @ 5:00 pm - 6:00 pm

What We Did Today:

  1. Learnt how to make the code more efficient by using classes. We created the Bird() class which we used to blit our birds onto the screen and change their positions in the .update() method
  2. Learnt how to use methods of different objects at the same time using pygame.sprite.Group()

Homework:

  • Create a new Cloud class, where the __init__ method has the same parameters as the Bird class, except size (because we want don’t want to alter the size of the image and keep it big)
  • In the update method, follow the same steps as in the Bird class where you will blit the cloud onto the screen and use a random integer for its speed
  • Now, back inside of main, you want to create a new Group of cloud objects in a new attribute called cloud_group

    Hint: to make a new group, use pygame.sprite.Group()

  • After creating the cloud_group, add a new cloud object inside of it using .add()
  • Inside of game_loop inside of main, you want to call the update method using the group to make a cloud appear at random
  • Now try adding another cloud object so that 2 clouds appear at one go

Notes:

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

Details

Date:
February 26
Time:
5:00 pm - 6:00 pm
Event Categories:
,
Verified by MonsterInsights