本文整理汇总了Python中World.readWorld方法的典型用法代码示例。如果您正苦于以下问题:Python World.readWorld方法的具体用法?Python World.readWorld怎么用?Python World.readWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.readWorld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: import World [as 别名]
# 或者: from World import readWorld [as 别名]
rightWall.image.fill((0,255,0))
print 'populate world'
world.backgrounds = [floor, leftWall, rightWall, roof, wall]
world.clips = [floor, leftWall, rightWall, roof, wall]
world.crateSpawnZones = [[100, 700, 100, 400]]
world.gravity = 2
world.mobSpawns = [[100, 100]]
print 'save world to disk'
util.toFile('test', world.toTag())'''
print 'loading world from file'
worldtag = util.fromFile('test')
world = World.readWorld(worldtag)
world.players = [player]
world.crates = [crate]
Session = Session.Session()
Session.worlds.append(world)
while 1:
Session.update()
'''
world.buildDrawList()
world.buildEntList()
示例2: World
# 需要导入模块: import World [as 别名]
# 或者: from World import readWorld [as 别名]
from Creatures import *
from Tile import *
import pygame as pg
from pygame import Color, Rect, Surface
from pygame.locals import *
import random as rng
import sys
from collections import defaultdict
#set up pygame
pg.init()
mainClock = pg.time.Clock()
fps=10
#setup world
world = World("Alipy",nrows=50,ncols=50)
world.readWorld("world.csv")
tile_list=defaultdict(dict)
tw=world.tile_width
th=world.tile_height
ww=world.ncols*tw
wh=world.nrows*th
r_offset=0
c_offset=0
for r in xrange(world.nrows):
c_offset=0
for c in xrange(world.ncols):
tile_list[world.getTile(r,c)]=Rect(c_offset,r_offset,tw,th)
c_offset+=th
r_offset+=tw
# set up the window
screen = pg.display.set_mode((ww, wh), 0, 32)