« All Events
6 PM – Python Game Development – Joel
April 4 @ 6:00 pm - 7:00 pm
Today we did:
- We made the homework (making the hitboxes) and started with the fireball class.
Homework:
- Create a new method called launch_fireball in main. It’s job is to make sure if the space key is pressed, it will create a fireball (you can choose a random coordinate, size can be around 50, and a random direction) and add it to the fireball group. In the game loop, don’t forget to call this function and also update the fireball group.
- There will be an error because in the fireball class, the self.rect accidentally took from self.image[0].get_width() and self.image[0].get_height(). Because we only have one image for the fireball, self.image is not a list, and so we cannot use “[0]”. You can simply remove it and the fireballs should spawn fine.
- The point of the homework is just to spawn the fireball in one place and see if it works.
- If you have any questions, feel free to email me at joel@ayclogic.com.