- This event has passed.
9 AM – Python Game Development
September 12, 2020 @ 9:00 am - 10:00 am
- We were able to integrate Cloud class into main.py so Cloud randomly appear on the screen.
- Homework:
- I have uploaded the latest files into google drive. Please download from there if you could not copy the code in the class.
- We want to make the bird appear from the right side of the screen and move to the left.
- Inside Bird.__init__ function, add another parameter: “direction”. direction could be either 90 (moving to the right) or 270 (moving to the left). Because we add a new parameter, in the main.py, when you create a new bird, you need to pass one more value. Look at inside main.py inside create_bird function. You should pass 270 for the direction parameter to make the bird move to the left.
- Save the direction parameter into self.direction.
- Inside Bird.update() function, if self.direction == 270, make the bird move to the left instead of going to the right. You have to change the self.x accordingly to make it move to the left. if self.direction == 90, the bird should move to the right.