【文件属性】:
文件名称:太空侵略者:Python中的太空侵略者游戏
文件大小:2.81MB
文件格式:ZIP
更新时间:2021-02-08 13:32:26
Python
太空侵略者游戏
这是我用youtube教程教程编写的Python简单游戏。
跑步
1.在项目根目录中,运行以下命令:
$ python3 main.py
Python代码
import pygame
import random
"""
Initialize the pygame
"""
pygame . init ()
"""
Game Constants
"""
GAME_IMAGE_PATH = "images/"
GAME_SOUNDS_PATH = "sounds/"
GAME_TITLE = "Space Invader"
GAME_WIDTH = 800
GAME_HEIGHT = 600
GAME_TITLE_IMG = "{0}ufo.png" . format ( GAME_IMAGE_PATH )
GAME_BLACK_COLOR = ( 0 , 0 , 0 )
G
【文件预览】:
space-invader-main
----.gitignore(2KB)
----images()
--------enemy_0.png(6KB)
--------background.jpg(1.25MB)
--------enemy_1.png(6KB)
--------enemy_2.png(5KB)
--------player.png(3KB)
--------screenshot.png(849KB)
--------bullet.png(1KB)
--------ufo.png(1KB)
--------enemy_3.png(5KB)
--------enemy_4.png(5KB)
--------enemy_5.png(4KB)
----LICENSE(1KB)
----README.md(9KB)
----.idea()
--------.gitignore(47B)
--------misc.xml(185B)
--------vcs.xml(180B)
--------inspectionProfiles()
--------space-invader.iml(284B)
--------modules.xml(278B)
----sounds()
--------laser.ogg(14KB)
--------background.ogg(640KB)
--------explosion.ogg(60KB)
----.vscode()
--------settings.json(45B)
----main.py(8KB)