本文整理汇总了Python中Level.Level.loadLevel方法的典型用法代码示例。如果您正苦于以下问题:Python Level.loadLevel方法的具体用法?Python Level.loadLevel怎么用?Python Level.loadLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level.Level
的用法示例。
在下文中一共展示了Level.loadLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Level
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import loadLevel [as 别名]
walls = pygame.sprite.Group()
projectiles = pygame.sprite.Group()
all = pygame.sprite.OrderedUpdates()
Tile.containers = (all, tiles)
Player.containers = (all, players)
Enemy.containers = (all, enemies)
Boss.containers = (all, enemies)
StartBlock.containers = (all, startBlocks)
EndBlock.containers = (all, endBlocks)
Bullet.containers = (all, projectiles)
Wall.containers = (all, walls)
level = Level(size, 30)
lev = 1
level.loadLevel(lev)
for monsterPos in level.monsterList:
Enemy(monsterPos,[random.randint(-2,2),random.randint(-2,2)])
for BossPos in level.BossList:
Enemy(BossPos,[random.randint(-2,2),random.randint(-2,2)])
player = Player(startBlocks.sprites()[0].rect.center)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w or event.key == pygame.K_UP:
player.go("up")
if event.key == pygame.K_d or event.key == pygame.K_RIGHT:
player.go("right")
if event.key == pygame.K_s or event.key == pygame.K_DOWN:
示例2: BackGround
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import loadLevel [as 别名]
run = True
bgColor = r,g,b
screen.fill(bgColor)
screen.blit(bgImage, bgRect)
screen.blit(startButton.image, startButton.rect)
pygame.display.flip()
clock.tick(60)
BackGround("images/Floors/Brick Floor.png")
player = Player([width/2, height/2])
level = Level(size, 40)
level.loadLevel("1")
timer = Score([80, height - 25], "Time: ", 36)
timerWait = 0
timerWaitMax = 6
score = Score([width-80, height-25], "Score: ", 36)
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
player.speedy += -8
if event.key == pygame.K_d:
player.speedx += 8
if event.key == pygame.K_s:
示例3: Level
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import loadLevel [as 别名]
if event.type == pygame.MOUSEBUTTONUP:
if startButton.release(event.pos):
run = "game"
bgColor = r,g,b
screen.fill(bgColor)
screen.blit(bgImage, bgRect)
screen.blit(startButton.image, startButton.rect)
pygame.display.flip()
clock.tick(60)
#BackGround("RSC/Background Images/basichallway.png")
level = Level(75, size)
level.loadLevel("31")
player = Player([width/3, height/2])
"""
timer = Score([80, height - 25], "Time: ", 36)
timerWait = 0
timerWaitMax = 6
score = Score([width-80, height-25], "Score: ", 36)
"""
enteredLevel = False
keylist = []
while run == "game" and player.living:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
if event.type == pygame.KEYDOWN:
示例4: BackGround
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import loadLevel [as 别名]
all.update(width, height)
dirty = all.draw(screen)
pygame.display.update(dirty)
pygame.display.flip()
clock.tick(60)
kind1 = ps1.select()
kind2 = ps2.select()
tileType = tile.select()
cleanscreenType = cleanscreen.select()
all.empty()
BackGround("Images/Screens/"+cleanscreenType, size)
level = Level(size, 50)
level.loadLevel("1", tileType)
player1 = PlayerBall([width/2, height/2], kind1)
print players.sprites()
print player1.groups()
player2 = PlayerBall([width/3, height/2], kind2)
print players.sprites()
print player2.groups()
timer = Score([80, height - 25], "Time: ", 36)
timerWait = 0
timerWaitMax = 6
score1 = Score([width-220,height-25], "Overall Score:", 36)