binrui -接炸藥1.0

# 接小球遊戲
import pygame
import sys
import time
# 1。加載中  loading  初始化
pygame.init()
# 2.設置窗口大小  dis分開 展覽館  展示  (寬,高)
screen = pygame.display.set_mode((890, 550))
# 4.設置標題
pygame.display.set_caption("接炸藥遊戲")
ball_x = 445
# 3.刷新
while True:
    # 電腦監控我們的操作
    # event 事件 pos  position 位置
    for event in pygame.event.get():
        print(event)
        # 判斷事件類型是不是退出
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    # 填充顏色
    screen.fill((250, 240, 230))

    ball_x = ball_x + 1
    if ball_x > 850:
        ball_x = 50
    # 畫小球: 窗口, 顏色 rgb , 位置(x,y)
    pygame.draw.circle(screen, (135, 206, 250), (ball_x, 275), 20)

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