033第12章 A SHIP THAT FIRES BULLETS_續10_pygame.sprite.Group class
💛20230202 晨讀感言:
💔對於已發射的子彈 如何管理 它們的 行經路線? 與其 管理 每顆子彈 , 還不如 將 已發射的 每顆子彈 全部納入 一個 group 來管理,這時,就會用到 pygame.sprite.Group class。
💛晨讀摘要:
💚248 Storing Bullets in a Group:Now that we have a Bullet class and the necessary settings defined, we can write code to fire a bullet each time the player presses the spacebar. ==We’ll create a group in AlienInvasion to store all the live bullets so we can manage the bullets that have already been fired==. This group will be an instance of the pygame.sprite.Group class, ==which behaves like a list with some extra functionality== that’s helpful when building games. We’ll use this group.
from:《python crash course》
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!
- Author
- More