PyEnvirons是PyGame的一个高级API,可以方便地为无监督的人工智能代理设计、开发和调试环境。它正在快速发展中,几乎每天都会添加一些功能。
PyEnviron的Python项目详细描述
pyenvirons
“PyEnvirons”是PyGame的一个更高级别的API,可以方便地为无监督的人工智能代理设计、开发和调试环境。它正在快速发展中,几乎每天都会添加一些功能。
用法和示例
下面是一个示例,向您展示pyenvirs是多么简单。
创建功能窗口
fromCoreimportPyEnviron#Importing PyEnviron libraryscreen=PyEnviron.Window([800,600],'testwindow')#Instantiating the window class to make a window, by specifying the size and name of the windowapp=PyEnviron.App(screen)#Instantiating the app class by giving the app our windowapp.run()#running our app
使用精灵、游戏对象和层
fromCoreimportPyEnviron#Importing the PyEnviron libraryscreen=PyEnviron.Window([800,600],'testwindow')#Instantiating the window class to make a window, by specifying the size and name of the windowapp=PyEnviron.App(screen)#Instantiating the app class by giving the app our windowimage=PyEnviron.Sprite('PyEnviron/SpriteTests/2635d6c2b056dfb.png')#Loading a sprite for our use by specfying a file pathlayer=PyEnviron.Layer()#Instantiating a layer for us to put sprites into#The gameobject class, will have all the variables regarding the sprite, like the image, position, rotation, and script attached to it.gm=PyEnviron.GameObject(image)#Instantiating a gameobject for us to use by giving it our sprite, position, rotation and scale are [0, 0], 0 degrees and [1, 1], respectivly, by defualt.layer.add_gameobject(gm)#Adding our game object to the layerapp.add_layer(layer)#Adding the layer to our appapp.run()#Running the app