American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Python Game Development – Sebastian

October 10, 2023 @ 6:00 pm - 7:00 pm

Today We Did
  1. Finished adding movement to Player class
  2. Changed Player image direction on movement
  3. Began understanding hitboxes, groupcollide, and the rect attribute
  4. You can always find the code we wrote in class in my Gitlab repository here:
    https://gitlab.com/gsugiart/tue-6-pm-dragon-birdie/-/tree/TUE-6PM-Sebastian
  5. In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
  1. Homework: For both your Player and Bird classes, create a “rect” attribute, and set it to pygame’s “Rect” object:

    pygame.Rect(self.x, self.y, self.right_images[0].get_width(), self.right_images[0].get_height())
  2.  In each of their update methods (before you blit their image to screen):
    1. First check if TESTING is set to True (be sure you added TESTING = True in config.py)
    2. If it is, draw the “rect” attribute to the screen with:
      pygame.draw.rect(self.screen, (255,0,255), self.rect)
  3. If everything is set up correctly, all birds & players should show their hitbox in red. To disable hitboxes, simply set the “TESTING” global variable (in config.py) to False.

Details

Date:
October 10, 2023
Time:
6:00 pm - 7:00 pm
Event Categories:
,
Verified by MonsterInsights