pygame
頁面Module:Message box/mbox.css沒有內容。頁面Template:Ambox/style.css沒有內容。
此條目翻譯品質不佳。 (2022年9月29日) |
package.lua第80行Lua錯誤:module 'Module:CGroup/core' not found
頁面Module:Infobox/styles.css沒有內容。
| File:Pygame logo.svg | |
| 腳本錯誤:沒有「InfoboxImageVariant」這個模塊。 | |
| 開發者 | pygame Community |
|---|---|
| 首次發布 | 2000年10月30日[1][2] |
| 當前版本 | 2.6.1(2024年8月30日[3]) |
| 操作系統 | 跨平台 |
| 類型 | API |
| 許可協議 | GNU寬通用公共許可證 |
| 網站 | http://www.pygame.org |
| 腳本錯誤:沒有「Template wrapper」這個模塊。 | |
pygame[4]是跨平台Python模塊組,專為電子遊戲設計。包含圖像、聲音。建立在SDL基礎上,允許實時電子遊戲研發而無需被低階語言,如C語言或是更低階的組合語言束縛。基於這樣一個設想,所有需要的遊戲功能和理念都(主要是圖像方面)完全簡化位遊戲邏輯本身,所有的資源結構都可以由高級語言提供,如Python。
pygame原為代替突然停止的pySDL[5]。
pygame在Android[編輯]
pygame應用程式能夠在Android手機和平板執行,採用pygame對於Android的子集(pgs4a)。[6] 支援Android的聲音,振動,鍵盤和加速。[7]但缺點是沒有辦法在iOS上執行pygame應用程式。其它pgs4a的主要限制是缺乏對於多點觸控的支援, 這使得雙指縮放,以及旋轉無法使用。另一個pygame在Android子集的替代方案是Kivy,[8]它包含了多點觸控及iOS的支援。
例子[編輯]
這段代碼假設在它運行的同一個目錄中有一個名為 ball.png 的(球的)圖像,它將在窗口中快速移動。[9]
import sys, pygame
pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
ball = pygame.image.load("ball.png")
ballrect = ball.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
ballrect = ballrect.move(speed)
if ballrect.left < 0 or ballrect.right > width:
speed[0] = -speed[0]
if ballrect.top < 0 or ballrect.bottom > height:
speed[1] = -speed[1]
screen.fill(black)
screen.blit(ball, ballrect)
pygame.display.flip()
其他[編輯]
package.lua第80行Lua錯誤:module 'Module:Portal/images/chinese' not found package.lua第80行Lua錯誤:module 'Module:Portal/images/chinese' not found 展示:
- Pyweek,遊戲製作競賽,時間限制在7天內
- Ludum Dare,LD48 遊戲製作競賽,時間限制在48小時內
2D引擎和庫:
- Phil's Pygame Utilities (PGU)(頁面存檔備份,存於網際網路檔案館)是增強pygame的庫和工具的集合。工具tile編輯器和一個關卡編輯器。(tile, isometric, hexagonal)GUI增強包括全功能GUI,html渲染,文檔輸出,文本渲染。函式庫包括精靈和拼接圖電子遊戲引擎(瓷磚圖, 立體圖, 六角圖), 和一個狀態引擎,計時器,高分系統。
- Pyglet,一個OpenGL庫,類似pygame
社群[編輯]
有定期的競賽,叫做PyWeek. 使用Python寫出遊戲(通常但不一定使用pygame)。[10][11][12]社群已經創造了許多Pygame的教學。[13][14][15][16][17][18]
參考[編輯]
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
- ↑ package.lua第80行Lua錯誤:module 'Module:Citation/CS1/Identifiers' not found
鏈接[編輯]
- Pygame homepage—Pygame documentation, wiki, news, download and more.
- An Introduction to Python Game Programming - written by Rene Dudfield and Geoff Howland
- Pyweek homepage(頁面存檔備份,存於網際網路檔案館)—regular contest to write a game during one week using Python (most entries use pygame).
- Pygame newsgroup[永久失效連結] (web access)— the "official" Pygame newsgroup,requires registration
- Line by line tutorial—Tutorial for beginners by Pete Shinners.
- Creating Games with Python(頁面存檔備份,存於網際網路檔案館) - A tutorial explaining how to use Pygame for game development and improved execution.
- pyGame Basics and Arinoid tutorials video tutorials at showmedo
- Beginning Game Development with Python and Pygame -- A new book discussing game development using Pygame
- Game Programming the L Line -- A book that introduces programming and game development with Python and pygame
- pyOpenGL(頁面存檔備份,存於網際網路檔案館) - Python OpenGL Bindings