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

wenwen
·
·
IPFS
·
太晚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

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!

wenwen探索網路世界和進入區塊鏈的過程或許很平凡,但我就是想分享給大家,若能幫助到有需要幫助的人,那就更好了。 有幫到你的話,記得按下方拍手圖,不需花你任何金錢,免費註冊Liker ID,就可對我化讚為賞:https://button.like.co/willie5068
  • Author
  • More

032第12章 A SHIP THAT FIRES BULLETS_續9_pygame.Rect() class

031第12章 A SHIP THAT FIRES BULLETS_續8_super().init()

030第12章 A SHIP THAT FIRES BULLETS_續7_PYGAME的文本