本文整理汇总了Python中level.Level.init方法的典型用法代码示例。如果您正苦于以下问题:Python Level.init方法的具体用法?Python Level.init怎么用?Python Level.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类level.Level
的用法示例。
在下文中一共展示了Level.init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import init [as 别名]
def start(self):
level = Level()
level.init()
(entities, trans) = parse_gsl_file(Config.data_path+'/testfile.gsl')
# parse_emdl_file(entities, Config.data_path+'/map/level10.map', level)
while True:
self.console.process_input()
self.input(pygame.event.get())
self.screen.fill((0, 0, 0))
pygame.time.wait(100)
level.update_on_events()
level.update()
level.draw(self.screen)
if self.show_states == True:
level.draw_debug(self.screen)
self.console.draw()
#self.screen.blit(surface, (0, 0))
pygame.display.flip()
示例2: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import init [as 别名]
class Game:
'''
classdocs
'''
camera = None
level = None
skyDome = None
vehicles = None
selectedVehicle = None
# controls
moveForwald = False
moveBackwald = False
straffLeft = False
straffRight = False
turnLeft = False
turnRight = False
millis = 0
gameConfig = None
def __init__(self, gameConfig):
'''
Constructor
'''
self.gameConfig = gameConfig
def init (self):
self.level = Level(self.gameConfig.levelFile)
self.level.init()
self.skyDome = SkyDome()
self.skyDome.init("textures/sky_1.jpg")
self.camera = Camera()
self.vehicles = []
for team in self.gameConfig.teams:
teamVehicles = self.gameConfig.initialPlayers / len(team.bases)
vehiclesPerBase = self.gameConfig.initialPlayers / len(team.bases)
for baseId in team.bases:
base = self.level.bases[baseId]
base.owner = team
vehiclesThisBase = int(ceil(vehiclesPerBase))
teamVehicles -= vehiclesThisBase
vehiclePositions = self.getInitialVehiclePositions(base, vehiclesThisBase)
for vehiclePosition in vehiclePositions:
# create and place the vehicle
vehicle = LightTank(VehicleType)
vehicle.init([vehiclePosition[0], vehiclePosition[1], 0], team)
self.vehicles.append(vehicle)
# the first vehicle is the players
if self.selectedVehicle == None:
self.selectedVehicle = vehicle
pathFinder = PathFinder()
path = pathFinder.findPath(1,1,17,17)
print path
def update (self, millis):
self.millis = millis
self.level.update()
# move vehicle
if self.turnLeft and not self.turnRight:
self.selectedVehicle.turnLeft()
if self.turnRight and not self.turnLeft:
self.selectedVehicle.turnRight()
if self.moveForwald and not self.moveBackwald:
self.selectedVehicle.moveForwald()
if self.moveBackwald and not self.moveForwald:
self.selectedVehicle.moveBackwald()
for vehicle in self.vehicles:
vehicle.update()
# set camera
self.camera.setPosition(*self.selectedVehicle.getCameraPosition());
self.camera.setDirection(self.selectedVehicle.aimDirection);
def paint (self):
self.camera.loadIdentity()
self.skyDome.paint()
self.level.paint()
glDisable(GL_TEXTURE_2D)
for vehicle in self.vehicles:
vehicle.paint()
glEnable(GL_TEXTURE_2D)
#.........这里部分代码省略.........