Task 3.2: Create an instance of player

If a class is a blueprint, then creating an instance is using that blueprint to make something!

  1. Outside of your class definition (in your main code), create a new player object!

💡 Hint

  • Generally, you can create a class instance like so:
  • 
    car_instance = Car("Red", 60)
            
  • This creates an instance of a car with the colour "Red" and a speed of 60.
  • Note: this assumes you have made a class called Car with the properties colour and speed. You can look at 3.1 to see an example of this.
  • Your Player class has the properties position_x, position_y, size, image, sprite.
  • You should add values inside the bracket, e.g. Player(...) that lines up with those properties.
  1. After you create the player instance, print out the player’s important properties to check they were created correctly.

💡 Hint

  • You can access a class property by using a dot, like this: car_instance.colour. This should be"Red".
  • Print the player's sprite.
  • Print the player's position_x.
  • Print the player's position_y.
  • Print the player's size.

🚩 Checkpoint

  • A player object stored in a variable called Player.
  • Printouts in the terminal showing the player's properties.