使用Python3+pygame模塊制作的飛機(jī)大戰(zhàn),好玩,酷炫 | 長(zhǎng)按左側(cè)二維碼 2 秒 (非本號(hào))
|
一、運(yùn)行效果二、部分示例代碼def main(): pygame.mixer.music.play(-1)
# 生成我方飛機(jī) me = myplane.MyPlane(bg_size)
enemies = pygame.sprite.Group()
# 生成敵方小型飛機(jī) small_enemies = pygame.sprite.Group() add_small_enemies(small_enemies, enemies, 15)
# 生成敵方中型飛機(jī) mid_enemies = pygame.sprite.Group() add_mid_enemies(mid_enemies, enemies, 4)
# 生成敵方大型飛機(jī) big_enemies = pygame.sprite.Group() add_big_enemies(big_enemies, enemies, 2)
# 生成普通子彈 bullet1 = [] bullet1_index = 0 BULLET1_NUM = 4 for i in range(BULLET1_NUM): bullet1.append(bullet.Bullet1(me.rect.midtop))
參考:https://www./67.html
|