此为历史版本和 IPFS 入口查阅区,回到作品页
wenwen
IPFS 指纹 这是什么

作品指纹

033第12章 A SHIP THAT FIRES BULLETS_續10_pygame.sprite.Group class

wenwen
·
·
太晚PO文,可以再早一點

💛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》

CC BY-NC-ND 2.0 授权