2021-06-30

python快速编程入门,实训项目《飞机大战》源码,素材(音乐,图片,字体)。整个项目工程
可运行
运行结果

class Game(object):
“”“游戏类”""
def init(self):
# 游戏主窗口
self.main_window = pygame.display.set_mode(SCREEN_RECT.size) # 创建窗口
pygame.display.set_caption(“飞机大战”) # 标题

    # 游戏状态属性
    self.is_game_over = False                  # 游戏结束标记
    self.is_pause = False                      # 游戏暂停标记

    #  精灵组属性
    self.all_group = pygame.sprite.Group()              # 所有精灵组
    self.enemies_group = pygame.sprite.Group()          # 敌机精灵组
    self.supplies_group = pygame.sprite.Group()         # 道具精灵组

    # 创建精灵
    """# 背景精灵,向下方移动
            GameSprite("background.png", 1, self.all_group)
            # 英雄精灵,静止不动
            hero = GameSprite("me1.png", 0, self.all_group)
            hero.rect.center = SCREEN_RECT.center   """
    # 创建 背景精灵,交替滚动
    self.all_group.add(Background(False), Background(True))
    # 指示器面板
    self.hud_panel = HudPanel(self.all_group)
    # 创建敌机
    self.create_enemies()
    # 英雄精灵
    self.hero = Hero(self.all_group)
    # 设置面板中的炸弹数量
    self.hud_panel.show_bomb(self.hero.bomb_count)

    """hero = Plane(1000, 5, 0, "me_down.wav", ["me%d.png" % i for i in range(1, 3)], "me1.png", 
            ["me_destroy_%d.png" % i for i in range(1, 5)], self.all_group)

            hero.rect.center = SCREEN_RECT.center                    # 显示在屏幕中央"""
    # 创建道具
    self.create_supplies()

    # 创建音乐播放器
    self.player = MusicPlayer("game_music.mp3")
    self.player.play_music()

game模块的Game类与构造方法。
需要可联系QQ:1975612468

以下是一个更复杂的 SQL 查询语句,它使用了多个子查询和窗口函数: WITH -- 定义一个子查询,获取销售额排名前10的产品 top_products AS ( SELECT product_id, SUM(sales) AS total_sales FROM orders WHERE order_date BETWEEN '2021-01-01' AND '2021-06-30' GROUP BY product_id ORDER BY total_sales DESC LIMIT 10 ), -- 定义一个子查询,获取销售额排名前10的客户 top_customers AS ( SELECT customer_id, SUM(sales) AS total_sales FROM orders WHERE order_date BETWEEN '2021-01-01' AND '2021-06-30' GROUP BY customer_id ORDER BY total_sales DESC LIMIT 10 ), -- 定义一个窗口函数,计算每个客户的销售额排名 customer_sales_rank AS ( SELECT customer_id, SUM(sales) AS total_sales, ROW_NUMBER() OVER (ORDER BY SUM(sales) DESC) AS sales_rank FROM orders WHERE order_date BETWEEN '2021-01-01' AND '2021-06-30' GROUP BY customer_id ) -- 最终查询,获取纽约市销售额排名前10的客户,以及他们购买的销售额排名前10的产品 SELECT customers.id AS customer_id, customers.name AS customer_name, products.id AS product_id, products.name AS product_name, SUM(orders.sales) AS total_sales FROM orders -- 连接顾客信息 INNER JOIN customers ON orders.customer_id = customers.id -- 连接产品信息 INNER JOIN products ON orders.product_id = products.id -- 仅查询纽约市的客户 WHERE customers.city = 'New York' -- 仅查询销售额排名前10的客户 AND customers.id IN (SELECT customer_id FROM top_customers) -- 仅查询销售额排名前10的产品 AND products.id IN (SELECT product_id FROM top_products) -- 仅查询客户销售额排名前10的订单 AND customers.id IN (SELECT customer_id FROM customer_sales_rank WHERE sales_rank <= 10) GROUP BY customers.id, customers.name, products.id, products.name ORDER BY customers.id, total_sales DESC, products.id;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值