Task 3.3: Create the draw method

  1. Create a new method called draw.

πŸ’‘ Hint

  • Use the def keyword.
  • It should be written inside your Food class (at the same indentation level as __init__()).
  • This method won’t take any arguments (only self).
  • This method will draw the food onto the screen.
  • In general, a method looks like:
  • 
    class Car:
        # These are our properties
        def __init__(self, colour, speed):
            colour = colour
            speed = speed
        β€Ž 
        # These are our methods
        def drive(self):
            # Do something here
    
  1. Draw the Sprite onto the Screen

πŸ’‘ Hint

  • Use screen.blit(...) to draw. Refer to your previous lines of code to see how to use this function!
  • The first thing you want to draw is the sprite.
  • The position to draw at is (position_x, position_y).

🚩 Checkpoint

  • A draw() method inside your Player class which knows how to:
    • Draw the sprite.
    • Place it at the correct position.