#导入pygame
import pygame
#导入random
import random
#初始化Pygame
pygame.init()
#设置窗口大小
size=(700, 500)
screen=pygame.display.set_mode(size)
pygame.RESIZABLE
#设置窗口标题
pygame.display.set_caption("平平无奇的游戏。")
#随机数
min_num=0
max_num=500
max_num2=700
random_num=random.randint(min_num, max_num)
random_num2=random.randint(min_num, max_num2)
#创建精灵
class MySprite(pygame.sprite.Sprite):
def __init__(self,x,y,width,height,color):
super().__init__()
# 设置游戏对象的尺寸和颜色(红,绿,蓝)
self.width=width
self.height=height
self.color=color
# 创建游戏对象的图像
self.image=pygame.Surface((width, height))
self.image.fill(color)
# 获取游戏对象的矩形