ziheng -接小球遊戲

import pygame
import time
# 1.加載中,初始化
pygame.init()
# 2.遊戲窗口  dis分開   play  display展覽  set設置
screen = pygame.display.set_mode((500, 700))
# 變量
ballx = 100
bally = 100
# up 上 date 日期  update升級,刷新     die死
while 1 > 0:
    # 監聽你動作  event 事件
    for event in pygame.event.get():
        print(event)
        if event.type == pygame.QUIT:
            pygame.quit()
    screen.fill((0,0,0))
    bally = bally + 1
    # 圓形:在什麼地方畫,color,位置,半徑
    pygame.draw.circle(screen,(0,255,108),(ballx,bally),66,0)
    pygame.display.update()
    time.sleep(0.1)



import turtle as t
# 全局變量
a = "我是王者"


def rte():
    # global 全球的
    global a
    # 函數裏的局部變量
    a = "我是青銅"


rte()
print(a)

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