资源简介
安装python,pip安装pygame,打开Pycharm编辑器直接启动py文件即可运行,本项目包含使用pyinstaller打包的c++驱动的exe文件,未安装环境也可直接点exe文件开始游戏,exe文件可以在任何windows系统运行
代码片段和文件信息
# Star Pusher (a Sokoban clone)
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/pygame
# Released under a “Simplified BSD“ license
import random sys copy os pygame
from pygame.locals import *
FPS = 30 # frames per second to update the screen
WINWIDTH = 800 # width of the program‘s window in pixels
WINHEIGHT = 600 # height in pixels
HALF_WINWIDTH = int(WINWIDTH / 2)
HALF_WINHEIGHT = int(WINHEIGHT / 2)
# The total width and height of each tile in pixels.
TILEWIDTH = 50
TILEHEIGHT = 85
TILEFLOORHEIGHT = 40
CAM_MOVE_SPEED = 5 # how many pixels per frame the camera moves
# The percentage of outdoor tiles that have additional
# decoration on them such as a tree or rock.
OUTSIDE_DECORATION_PCT = 20
BRIGHTBLUE = ( 0 170 255)
WHITE = (255 255 255)
BGCOLOR = BRIGHTBLUE
TEXTCOLOR = WHITE
UP = ‘up‘
DOWN = ‘down‘
LEFT = ‘left‘
RIGHT = ‘right‘
def main():
global FPSCLOCK DISPLAYSURF IMAGESDICT TILEMAPPING OUTSIDEDECOMAPPING BASICFONT PlayerIMAGES currentImage
# Pygame initialization and basic set up of the global variables.
pygame.init()
FPSCLOCK = pygame.time.Clock()
# Because the Surface object stored in DISPLAYSURF was returned
# from the pygame.display.set_mode() function this is the
# Surface object that is drawn to the actual computer screen
# when pygame.display.update() is called.
DISPLAYSURF = pygame.display.set_mode((WINWIDTH WINHEIGHT))
pygame.display.set_caption(‘Star Pusher‘)
BASICFONT = pygame.font.Font(‘freesansbold.ttf‘ 18)
# A global dict value that will contain all the Pygame
# Surface objects returned by pygame.image.load().
IMAGESDICT = {‘uncovered goal‘: pygame.image.load(‘RedSelector.png‘)
‘covered goal‘: pygame.image.load(‘Selector.png‘)
‘star‘: pygame.image.load(‘Star.png‘)
‘corner‘: pygame.image.load(‘Wall_Block_Tall.png‘)
‘wall‘: pygame.image.load(‘Wood_Block_Tall.png‘)
‘inside floor‘: pygame.image.load(‘Plain_Block.png‘)
‘outside floor‘: pygame.image.load(‘Grass_Block.png‘)
‘title‘: pygame.image.load(‘star_title.png‘)
‘solved‘: pygame.image.load(‘star_solved.png‘)
‘princess‘: pygame.image.load(‘princess.png‘)
‘boy‘: pygame.image.load(‘boy.png‘)
‘catgirl‘: pygame.image.load(‘catgirl.png‘)
‘horngirl‘: pygame.image.load(‘horngirl.png‘)
‘pinkgirl‘: pygame.image.load(‘pinkgirl.png‘)
‘rock‘: pygame.image.load(‘Rock.png‘)
‘short tree‘: pygame.image.load(‘Tree_Short.png‘)
‘tall tree‘: pygame.image.load(‘Tree_Tall.png‘)
‘ugly tree‘: pygame.image.load(‘Tree_Ugly.png‘)}
# These dict values are global and map the character that appears
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6581 2011-06-12 02:33 starpusher\boy.png
文件 733582 2018-08-10 15:42 starpusher\build\starpusher\ba
文件 71246 2018-08-10 15:42 starpusher\build\starpusher\out00-Analysis.toc
文件 17798 2018-08-10 15:42 starpusher\build\starpusher\out00-EXE.toc
文件 25427326 2018-08-10 15:42 starpusher\build\starpusher\out00-PKG.pkg
文件 16758 2018-08-10 15:42 starpusher\build\starpusher\out00-PKG.toc
文件 3411033 2018-08-10 15:42 starpusher\build\starpusher\out00-PYZ.pyz
文件 55419 2018-08-10 15:42 starpusher\build\starpusher\out00-PYZ.toc
文件 1035 2018-08-10 15:42 starpusher\build\starpusher\starpusher.exe.manifest
文件 12233 2018-08-10 15:42 starpusher\build\starpusher\warnstarpusher.txt
文件 868696 2018-08-10 15:42 starpusher\build\starpusher\xref-starpusher.html
文件 7270 2011-06-12 02:32 starpusher\catgirl.png
文件 6581 2011-06-12 02:33 starpusher\dist\boy.png
文件 7270 2011-06-12 02:32 starpusher\dist\catgirl.png
文件 416116 2014-10-10 20:46 starpusher\dist\FreeSansBold.ttf
文件 8244 2011-06-11 14:59 starpusher\dist\Grass_Block.png
文件 7186 2011-06-12 02:32 starpusher\dist\horngirl.png
文件 6924 2011-06-12 02:32 starpusher\dist\pinkgirl.png
文件 3433 2011-06-11 22:23 starpusher\dist\Plain_Block.png
文件 7411 2011-06-11 23:06 starpusher\dist\princess.png
文件 10418 2011-06-11 22:55 starpusher\dist\RedSelector.png
文件 7902 2011-06-12 01:00 starpusher\dist\Rock.png
文件 10243 2011-06-11 22:55 starpusher\dist\Selector.png
文件 9824 2011-06-11 22:55 starpusher\dist\Star.png
文件 25699198 2018-08-10 15:42 starpusher\dist\starpusher.exe
文件 24894 2012-02-02 23:46 starpusher\dist\starpusher.py
文件 59164 2012-01-10 17:53 starpusher\dist\starPusherLevels.txt
文件 67300 2011-06-11 23:08 starpusher\dist\star_solved.png
文件 93531 2011-06-11 23:08 starpusher\dist\star_ti
文件 9771 2011-06-12 01:00 starpusher\dist\Tree_Short.png
............此处省略33个文件信息
相关资源
- 《剑指Offer:名企面试官精讲典型编程
- python实现串口传文件调用PCOMM.dll Zm
- OpenCV算法精讲:基于Python与c++
- python扩展需要安装的VC++环境python2.x
- OpenCV算法精解-代码.rar
- 预编译好的python3.6+window10下的annoy包
- Python+wxpython邮件收发客户端
- 预编译好的python3.7+window10下的annoy包
- C语言、Python实现TF-IDF算法
- Windows下配置python_pcl全套资料
- casia语音情感识别SVM分类
- python37_d.lib
- 基于python实现巴特沃斯低通滤波
- Python3+Opencv343环境搭建 dll load failed问
- 引导滤波_Cpp_Python.rar
- VS2010C++调用python报错无法打开包括文
- python wordcloud whl包
- linux 下 python调用c或者c++编写的代码使
- python35_d.lib
- python版本获取百度搜索结果页面的信
- 节点大小平衡树(Size Balanced Tree c++和
- pymssql-2.1.4-cp38-cp38-win_amd64.whl
- Python基础教程第3版中英文版+源码_超
- grpc-x86_64-1.27.2-2-any.zip
- 一种多尺度检测的KCF的python实现代码
- visualcppbuildtools_full.exe安装包
- 新编Windows API参考大全全中文、win32
- Microsoft Visual C++ 14.0
- 从C++导出类到Python
- Linux下C++ 与python人脸检测
评论
共有 条评论