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 = 0running = True
clock = pygame.time.Clock()while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = Falsescreen.fill(white)
if launching:
if launch_frame_count < launch_frames:
模拟火箭发射的过程(Python版)
最新推荐文章于 2024-04-17 10:03:09 发布