本文整理汇总了Python中Level.Level.load_level方法的典型用法代码示例。如果您正苦于以下问题:Python Level.load_level方法的具体用法?Python Level.load_level怎么用?Python Level.load_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level.Level
的用法示例。
在下文中一共展示了Level.load_level方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GameSpace
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import load_level [as 别名]
class GameSpace():
def __init__(self):
pygame.init()
pygame.display.set_caption('Tanks')
self.screen = pygame.display.set_mode(WIN_DISPLAY)
self.background = Surface(WIN_DISPLAY)
self.background.fill(Color(WIN_COLOR))
self.timer = pygame.time.Clock()
self.cf = ClientConnFactory(self)
reactor.connectTCP(HOST,PORT,self.cf)
reactor.run()
def start(self):
self.player = Player(100,100)# инициализируем Tank
self.level1 = Level('level1.txt')#Инициализируем level1
self.level1.load_level()
#self.test_loop()
def tick(self):
print 'tick'
for e in pygame.event.get():
if e.type == QUIT:
reactor.stop()
raise SystemExit, "Quit"
if e.type == KEYDOWN and e.key == K_LEFT:
print '*'*100
print "KEYDOWN K_LEFT"
self.sendData("KEYDOWN LEFT! Yu-hooo")
print 'end tick for'
#self.sendData("**********************Hello!")
self.screen.blit(self.background,(0,0))
self.screen.blit(self.player.image,(100,100))
pygame.display.update()
def sendData(self, data):
self.cf.conn.send(data)
def addData(self, data):
print "INCOMING: ", data
def test_loop(self):
while True:
for e in pygame.event.get():
if e.type == QUIT:
raise SystemExit, "QUIT"
if e.type == KEYDOWN and e.key == K_LEFT:
print "KEYDOWN K_LEFT"
self.screen.blit(self.background,(0,0))
self.screen.blit(self.player.image,(100,100))
pygame.display.update()