python版本推箱子(界面美化包含打包exe文件)


安装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  starpusheroy.png

     文件     733582  2018-08-10 15:42  starpusheruildstarpusherase_library.zip

     文件      71246  2018-08-10 15:42  starpusheruildstarpusherout00-Analysis.toc

     文件      17798  2018-08-10 15:42  starpusheruildstarpusherout00-EXE.toc

     文件   25427326  2018-08-10 15:42  starpusheruildstarpusherout00-PKG.pkg

     文件      16758  2018-08-10 15:42  starpusheruildstarpusherout00-PKG.toc

     文件    3411033  2018-08-10 15:42  starpusheruildstarpusherout00-PYZ.pyz

     文件      55419  2018-08-10 15:42  starpusheruildstarpusherout00-PYZ.toc

     文件       1035  2018-08-10 15:42  starpusheruildstarpusherstarpusher.exe.manifest

     文件      12233  2018-08-10 15:42  starpusheruildstarpusherwarnstarpusher.txt

     文件     868696  2018-08-10 15:42  starpusheruildstarpusherxref-starpusher.html

     文件       7270  2011-06-12 02:32  starpushercatgirl.png

     文件       6581  2011-06-12 02:33  starpusherdistoy.png

     文件       7270  2011-06-12 02:32  starpusherdistcatgirl.png

     文件     416116  2014-10-10 20:46  starpusherdistFreeSansBold.ttf

     文件       8244  2011-06-11 14:59  starpusherdistGrass_Block.png

     文件       7186  2011-06-12 02:32  starpusherdisthorngirl.png

     文件       6924  2011-06-12 02:32  starpusherdistpinkgirl.png

     文件       3433  2011-06-11 22:23  starpusherdistPlain_Block.png

     文件       7411  2011-06-11 23:06  starpusherdistprincess.png

     文件      10418  2011-06-11 22:55  starpusherdistRedSelector.png

     文件       7902  2011-06-12 01:00  starpusherdistRock.png

     文件      10243  2011-06-11 22:55  starpusherdistSelector.png

     文件       9824  2011-06-11 22:55  starpusherdistStar.png

     文件   25699198  2018-08-10 15:42  starpusherdiststarpusher.exe

     文件      24894  2012-02-02 23:46  starpusherdiststarpusher.py

     文件      59164  2012-01-10 17:53  starpusherdiststarPusherLevels.txt

     文件      67300  2011-06-11 23:08  starpusherdiststar_solved.png

     文件      93531  2011-06-11 23:08  starpusherdiststar_title.png

     文件       9771  2011-06-12 01:00  starpusherdistTree_Short.png

............此处省略33个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)