zhaowei -接小球游戏1.0

import pygame
import time
# 游戏初始化  loading  加载中
pygame.init()
# 设置游戏界面大小   dis 分开   play 玩  ----展览,展示
chuang_kou = pygame.display.set_mode((660,480))

# up上面 date日期  update升级
qiu_x = 100
qiu_y = 110
qiu_z = 55
qiu_r = 21

speed_y = 1
speed_x = 1
speed_r = 1
speed_z = 1


while 1 > 0:
    # 鼠标  键盘
    for jiankong in pygame.event.get():
        print(jiankong)
        # type 类型   QUIT 退出游戏
        if jiankong.type == pygame.QUIT:
            pygame.quit()
    # 修改背景颜色 fill
    chuang_kou.fill((31,111,91))
    qiu_y = qiu_y+ speed_y
    qiu_x = qiu_x + speed_x

    if qiu_y > 480:
        speed_y = -1
    elif qiu_y < 0:
        speed_y = 1
    if qiu_x>660:
        speed_x = -1
    elif qiu_x < 0:
        speed_x = 1

    qiu_r = qiu_r + speed_r
    qiu_z = speed_z + qiu_z
    if qiu_z > 660:
       speed_z = -1
    elif qiu_z < 0:
        speed_z = 1
    if qiu_r > 480:
         speed_r = -1
    elif qiu_r < 0:
         speed_r = 1

    # 画 draw 一个圆 circle:窗口,(r,g,b),(x,y),半径
    pygame.draw.circle(chuang_kou,(204,222,111),(qiu_x,qiu_y),30)
    pygame.draw.circle(chuang_kou,(111,121,211),(qiu_z,qiu_r),30)

    # 画 draw 一个 长方形 rect:窗口,(r,g,b),()


    pygame.display.update()


# CPU:负责计算



猜你喜欢

转载自blog.csdn.net/houlaos/article/details/106793285