aden -接球遊戲 2.0

import pygame
import time
# 遊戲初始化
pygame.init()
# 設置窗口大小  640長度  窗口寬度500
screen = pygame.display.set_mode((640, 500))
x = 100 # x經度
y = 100
a = 200
b = 200
r, g, b = 100, 200, 300
while 1 < 100:
    # 事件:我們對電腦的物理操作,按鍵,鼠標(按鍵,移動)
    for event in pygame.event.get():
        print(event)
        if event.type == pygame.QUIT:
            pygame.quit() # 退出遊戲

    x = x + 1
    if x > 640:
        x = 0
    screen.fill((0, 0, 0))
    b = b + 1
    if b > 640:
        b = 0
    # 畫小球:屏幕,rgb三基色,座標,半徑
    pygame.draw.circle(screen, (255, 100, 100), (x, y), 23)
    pygame.draw.circle(screen,(200,200,200),(a,b), 23)
    # time.sleep(1)
    # 刷新
    pygame.display.update()


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章