American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Python Game Development – Sebastian

December 5, 2023 @ 6:00 pm - 7:00 pm

Today We Did
  1. Blitted coin images to screen
  2. Created player class
  3. Added player’s jump functionality using gravity
  4. Remembered how to use the ASCII table to detect which key the user typed
  5. You can always find the code we wrote in class in my Gitlab repository here:
    https://gitlab.com/gsugiart/tue-6-pm-flappy-bird/-/tree/Sebastian?ref_type=heads
  6. In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
  1. Homework: Next class we will begin developing collisions between different sprites, please add the “self.rect” attribute to all classes which will need to handle collisions.
    1. To create this pygame rectangle for collisions, we use the method:
      self.rect = pygame.Rect(x, y, width, height)

      The x and y will be simple for every class since they all have attributes for x and y, but you will have to think a bit more to get the width & height.

    2. The width & height of a rectangle should be based off the image(s) corresponding to the class. We can get an image’s width and height with these methods:
      image.get_width()
      image.get_height()

      The tricky part will be to get a singular image, since some classes have lists of images instead of just a single image! Remember how to index inside of a list and grab one image to fix this. Does it matter which image we get from the list, or are they all the same width/height?

  2. Once you added this self.rect attribute to 3 classes without any errors, you know you’re done.

Details

Date:
December 5, 2023
Time:
6:00 pm - 7:00 pm
Event Categories:
,
Verified by MonsterInsights