模拟火箭发射的过程(Python版)

import pygame

# 初始化Pygame
pygame.init()

# 设置窗口尺寸
width, height = 800, 600
screen = pygame.display.set_mode((width, height))

# 定义颜色
white = (255, 255, 255)
blue = (0, 0, 255)
red = (255, 0, 0)
yellow = (255, 255, 0)

# 定义火箭的参数
rocket_width = 50
rocket_height = 100
rocket_x = width // 2 - rocket_width // 2
rocket_y = height - rocket_height - 10
rocket_speed = 2

# 定义火箭发射过程的帧数
launch_frames = 100

# 定义火箭的状态
launching = True
launch_frame_count = 0

running = True
clock = pygame.time.Clock()

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    screen.fill(white)

    if launching:
        if launch_frame_count < launch_frames:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值