python中的snip用法_--snip--总是报错,找了好久不知道问题出在哪,望大佬求解(python-pygame)...
生活随笔
收集整理的這篇文章主要介紹了
python中的snip用法_--snip--总是报错,找了好久不知道问题出在哪,望大佬求解(python-pygame)...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
import sys #玩家退出時, 我們將使用模塊sys 來退出游戲
import pygame
def run_game(): #定義run_game函數
pygame.init()
screen=pygame.display.set_mode((1200,700))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pygame.display.flip()
run_game()
--snip--
def run_game():
--snip--
pygame.display.set_caption('Alien Invasion')
#設置背景色
bg_color=(230, 0, 0)
#開始游戲主循環
while True:
#監聽鍵盤和鼠標事件
--snip--
#每次循環時都重繪屏幕
screen.fill(bg_color)
#讓最近繪制的屏幕可見
pygame.display.flip()
run_game()
總結
以上是生活随笔為你收集整理的python中的snip用法_--snip--总是报错,找了好久不知道问题出在哪,望大佬求解(python-pygame)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: idea 查看方法在哪被调用快捷键_In
- 下一篇: 欧拉角-简单易懂