本文整理汇总了Python中level.Level.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Level.__init__方法的具体用法?Python Level.__init__怎么用?Python Level.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类level.Level
的用法示例。
在下文中一共展示了Level.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self):
Level.__init__(self)
self.name = "Breakout Minus Bricks 2"
# Rect that objects are allowed to move inside
global move_space
move_space = pygame.Rect(grid_step, grid_step, shared.dim.x - 2*grid_step, shared.dim.y - 2*grid_step)
示例2: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, player, AI):
Level.__init__(self,player, AI)
#enemies = [[40, 40, 0, 0, 'Basic_enemy', 0],
# [40, 40, 0, 0, 'Basic_enemy', 1]]
self.parse_map('tutorial_map.txt');
"""
示例3: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, level, game, raw, *args, name="GenericLoadScreenLevel",distortion_params=False,color=(30,30,30),scroll=0,autoscroll_speed=(0.0,0.0),vis_ofs=0,audio_section="current",**kwargs):
Level.__init__(self, level, game, raw, *args,
distortion_params=distortion_params,
color=color,
scroll=scroll,
autoscroll_speed=autoscroll_speed,
vis_ofs=vis_ofs,
audio_section=audio_section,
**kwargs
)
示例4: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, player, AI):
Level.__init__(self,player, AI)
enemies = {
'G': initGhost,
'S': initSpider,
'M': initMonkey
}
self.parse_map('tutorial_map.txt', enemies, initEnemy)
self.set_background_image('tutorial_background.png')
self.music = 'levels/forest.mp3'
示例5: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, player, AI):
Level.__init__(self,player, AI)
enemies = {
'G': initGhost,
'S': initSpider,
'M': initMonkey
}
self.parse_map('level1_map.txt', enemies, initEnemy)
self.set_background_image('tutorial_background.png')
self.background_image = pygame.transform.scale(self.background_image, (self.level_width, self.level_height - BLOCK_HEIGHT*3))
self.music = 'levels/forest.mp3'
示例6: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__ (self, game, event_handler, num_cars = 2):
event_handler.add_key_handlers([
(conf.KEYS_BACK, lambda *args: game.quit_backend(), eh.MODE_ONDOWN)
])
Level.__init__(self, game, event_handler, 0, False)
self.accel = 0
self.scores = [0] * num_cars
self._num_players = num_cars
self.init_opts((
('Start', 1, self.start_level),
('Players: ', 2, self._num_players, 1, 4, 1, '{0}', self.change_players),
('Graphics: ', 2, conf.GRAPHICS, 0, None, .1, '{0:.1f}', self.change_graphics),
('Health: ', 3, conf.CAR_HEALTH_ON, ('off', 'on'), self.change_health),
('Health: ', 2, conf.CAR_HEALTH_MULTIPLIER, 0, None, .1, '{0:.1f}', self.change_health, False),
('Quit', 1, self.game.quit_backend)
))
示例7: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, player, AI):
Level.__init__(self,player, AI)
enemies = {
}
self.parse_map('end.txt', enemies, initEnemy)
self.set_background_image('level2_background.gif')
self.background_image = pygame.transform.scale(self.background_image, (self.level_width, self.level_height - BLOCK_HEIGHT*5))
myFont = pygame.font.SysFont("monospace", 100)
title = myFont.render("YOUR A WINNER", 1, (255,255,255))
self.title_list.append(title)
self.music = 'levels/forest.mp3'
示例8: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, player, AI):
Level.__init__(self,player, AI)
enemies = {
}
self.parse_map('menu.txt', enemies, initEnemy)
self.set_background_image('menu.png')
self.background_image = pygame.transform.scale(self.background_image, (self.level_width, self.level_height - BLOCK_HEIGHT*5))
myFont = pygame.font.SysFont("monospace", 100)
title = myFont.render("Imaginary", 1, (255,255,255))
self.title_list.append(title)
# block for loading
myFont2 = pygame.font.SysFont("monospace", 50)
title2 = myFont2.render("Load", 1, (255,255,255))
self.load_block = title2
示例9: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self):
Level.__init__(self)
self.name = "Template Level"
示例10: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self):
Level.__init__(self)
self._init_plates()
示例11: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, world, image, id):
midx = constants.SCREEN_WIDTH / 2.0
midy = constants.SCREEN_HEIGHT / 2.0
self.id = id
self.image = image
self.img = pygame.image.load(image).convert()
playerAnim = pyganim.PygAnimation([('images/granny.png', 0.1), ('images/granny2.png', 0.1), ('images/granny3.png', 0.1), ('images/granny2.png', 0.1), ('images/granny.png', 0.1),
('images/grannyr.png', 0.1), ('images/granny2r.png', 0.1), ('images/granny3r.png', 0.1), ('images/granny2r.png', 0.1), ('images/grannyr.png', 0.1),
('images/grannyf.png', 0.1), ('images/grannyf2.png', 0.1), ('images/grannyf3.png', 0.1), ('images/grannyf2.png', 0.1), ('images/grannyf.png', 0.1), ('images/granny.png', 0.1),
('images/grannyfr.png', 0.1), ('images/grannyf2r.png', 0.1), ('images/grannyf3r.png', 0.1), ('images/grannyf2r.png', 0.1), ('images/grannyfr.png', 0.1), ('images/granny.png', 0.1)])
self.player = Player((midx - 0 ,midy + 300), 'images/granny.png', playerAnim, world)
Level.__init__(self, self.player)
self.walls = [
#screenPos, Size
# MAIN WALLS #############################################
Wall((midx - 635, midy - 90), (3,300), world),
Wall((midx + 620, midy - 90), (3,300), world),
Wall((midx + 640, midy - 310), (1280,3), world),
Wall((midx + 440, midy + 175), (400,40), world),
Wall((midx - 450, midy + 175), (400,40), world),
Wall((midx - 465, midy - 130), (380,30), world),
Wall((midx + 270, midy - 130), (225,30), world),
Wall((midx - 450, midy + 67), (15,100), world),
Wall((midx - 470, midy + 10), (30,40), world),
Wall((midx - 240, midy + 120), (15,40), world),
Wall((midx - 240, midy - 50), (15,40), world),
Wall((midx + 210, midy + 60), (15,70), world),
Wall((midx + 123, midy - 170), (15,20), world),
Wall((midx + 430, midy - 170), (15,20), world),
Wall((midx - 155, midy - 200), (10,40), world),
Wall((midx + 440, midy + 350), (400,40), world),
Wall((midx - 450, midy + 350), (400,40), world),
]
self.rooms = [
Room(0, (midx - 20, midy + 30), (450, 320)),
Room(1, (midx + 430, midy + 30), (450, 320)),
Room(2, (midx - 350, midy + 30), (220, 320)),
Room(3, (midx - 570, midy + 30), (220, 320)),
Room(4, (midx + 360, midy - 290), (500, 320)),
Room(5, (midx - 20, midy - 290), (250, 310)),
Room(6, (midx - 400, midy - 290), (500, 310)),
]
victimAnim = pyganim.PygAnimation([('images/victim.png', 0.1), ('images/victim2.png', 0.1), ('images/victim3.png', 0.1), ('images/victim2.png', 0.1), ('images/victim.png', 0.1),
('images/victimr.png', 0.1), ('images/victim2r.png', 0.1), ('images/victim3r.png', 0.1), ('images/victim2r.png', 0.1), ('images/victimr.png', 0.1)])
self.victims = [
Victim(
(midx + 100, midy - 60),
'images/victim.png',
victimAnim,
world,
TaskList([
#screenpos, time(ms), name
Task((284, 138), 2000, "a"),
Task((623, 391), 2000, "b"),
Task((1151, 417), 2000, "c"),
Task((290, 403), 2000, "c"),
Task((1167, 129), 2000, "c"),
]
),
'images/collisionMap2.png'
),
Victim(
(midx + 500, midy - 100),
'images/victim.png',
victimAnim,
world,
TaskList([
#screenpos, time(ms), name
Task((284, 138), 2000, "a"),
Task((623, 391), 2000, "b"),
Task((1151, 417), 2000, "c"),
Task((290, 403), 2000, "c"),
Task((1167, 129), 2000, "c"),
]
),
'images/collisionMap2.png'
),
Victim(
(midx - 500, midy - 60),
'images/victim.png',
victimAnim,
world,
TaskList([
#screenpos, time(ms), name
Task((284, 138), 2000, "a"),
Task((623, 391), 2000, "b"),
Task((290, 403), 2000, "c"),
Task((1167, 129), 2000, "c"),
Task((1151, 417), 2000, "c"),
]
),
'images/collisionMap2.png'
),
]
tvAnim = pyganim.PygAnimation([('images/tv.png', 0.1), ('images/tv3.png', 0.1), ('images/tv4.png', 0.1)])
#.........这里部分代码省略.........
示例12: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self, world, image, id):
midx = constants.SCREEN_WIDTH / 2.0
midy = constants.SCREEN_HEIGHT / 2.0
self.id = id
self.image = image
self.img = pygame.image.load(image).convert()
playerAnim = pyganim.PygAnimation([('images/granny.png', 0.1), ('images/granny2.png', 0.1), ('images/granny3.png', 0.1), ('images/granny2.png', 0.1), ('images/granny.png', 0.1),
('images/grannyr.png', 0.1), ('images/granny2r.png', 0.1), ('images/granny3r.png', 0.1), ('images/granny2r.png', 0.1), ('images/grannyr.png', 0.1),
('images/grannyf.png', 0.1), ('images/grannyf2.png', 0.1), ('images/grannyf3.png', 0.1), ('images/grannyf2.png', 0.1), ('images/grannyf.png', 0.1), ('images/granny.png', 0.1),
('images/grannyfr.png', 0.1), ('images/grannyf2r.png', 0.1), ('images/grannyf3r.png', 0.1), ('images/grannyf2r.png', 0.1), ('images/grannyfr.png', 0.1), ('images/granny.png', 0.1)])
self.player = Player((midx - 430 ,midy + 200), 'images/granny.png', playerAnim, world)
Level.__init__(self, self.player)
self.walls = [
#screenPos, Size
# MAIN WALLS #############################################
Wall((midx - 545, midy - 20), (3,250), world), #LEFT WALL
Wall((midx - 235, midy - 205), (345,70), world), # TOP WALL
Wall((midx + 350, midy - 305), (240,50), world), # TOP WALL
Wall((midx, midy + 220), (540,3), world), # BOTTOM WALL
Wall((midx + 522, midy - 155), (3,90), world), #RIGHT WALL TOP
Wall((midx + 522, midy + 120), (3,110), world), #RIGHT WALL BOTTOM
Wall((midx + 600, midy + 20), (60,3), world), #OUTSIDE TOP
Wall((midx + 600, midy - 65), (60,3), world), #OUTSIDE BOTTOM
# GRANNY ROOM ############################################
Wall((midx - 386, midy + 110), (10,120), world), #GRANNY RIGHT WALL LARGE
Wall((midx - 410, midy + 15), (10,30), world), #GRANNY RIGHT WALL SMALL
Wall((midx - 510, midy + 60 ), (40,70), world), #GRANNY LEFT WALL
# CORRIDOR ##############################################
Wall((midx - 60, midy + 100), (300,120), world), # BOTTOM WALL
Wall((midx - 60, midy + 160), (350,100), world), # BOTTOM WALL 2
Wall((midx + 410, midy + 160), (25, 300), world), # RECEPTION WALL
Wall((midx + 300, midy - 120), (100, 30), world), # RECEPTION WALL
Wall((midx + 390, midy + 90), (40, 30), world), # RECEPTION WALL
]
self.rooms = [
Room(0, (midx - 500, midy + 180), (300, 300)),
Room(1, (midx - 155, midy - 60), (750, 170)),
Room(2, (midx + 320, midy - 222), (440, 150)),
Room(3, (midx + 320, midy + 70), (200, 400)),
]
victimAnim = pyganim.PygAnimation([('images/victim.png', 0.1), ('images/victim2.png', 0.1), ('images/victim3.png', 0.1), ('images/victim2.png', 0.1), ('images/victim.png', 0.1),
('images/victimr.png', 0.1), ('images/victim2r.png', 0.1), ('images/victim3r.png', 0.1), ('images/victim2r.png', 0.1), ('images/victimr.png', 0.1)])
self.victims = [
Victim(
(midx + 100, midy - 60),
'images/victim.png',
victimAnim,
world,
TaskList([
#screenpos, time(ms), name
Task((964, 386), 3000, "a"),
Task((374, 291), 3000, "b"),
#Task((1215, 342), 2000, "c"),
]
),
'images/collisionMap.png'
),
]
tvAnim = pyganim.PygAnimation([('images/tv.png', 0.1), ('images/tv3.png', 0.1), ('images/tv4.png', 0.1)])
self.destructables = [
Destructable((midx + 430, 500), tvAnim, 'images/tv.png'),
Destructable((midx + 250, 510), tvAnim, 'images/tv.png'),
]
self.asignRooms()
示例13: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self):
Level.__init__(self)
self._init_plates()
self._init_obstacles()
示例14: __init__
# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import __init__ [as 别名]
def __init__(self,player):
Level.__init__(self, player)
self.obstacles = [
[800,20,20,SCREEN_HEIGHT-120],
[200,20,860,SCREEN_HEIGHT-120],
[SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-220],
[150,20,210,SCREEN_HEIGHT-220],
[700,20,20,SCREEN_HEIGHT-320],
[300,20,760,SCREEN_HEIGHT-320],
[SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-420],
[200,20,160,SCREEN_HEIGHT-420],
[500,20,20,SCREEN_HEIGHT-520],
[400,20,560,SCREEN_HEIGHT-520],
[SCREEN_WIDTH-330,20,350,SCREEN_HEIGHT-620],
[100,20,210,SCREEN_HEIGHT-620],
[750,20,20,SCREEN_HEIGHT-720],
[200,20,810,SCREEN_HEIGHT-720],
[SCREEN_WIDTH-380,20,400,SCREEN_HEIGHT-820],
[150,20,210,SCREEN_HEIGHT-820],
[100,20,600,SCREEN_HEIGHT-920],
[200,20,740,SCREEN_HEIGHT-920],
]
self.ladders = [
[820,SCREEN_HEIGHT-120,55,100],
[350,SCREEN_HEIGHT-220,55,100],
[710,SCREEN_HEIGHT-320,55,100],
[350,SCREEN_HEIGHT-420,55,100],
[515,SCREEN_HEIGHT-520,55,100],
[305,SCREEN_HEIGHT-620,55,100],
[755,SCREEN_HEIGHT-720,55,100],
[355,SCREEN_HEIGHT-820,55,100],
[695,SCREEN_HEIGHT-920,55,100],
[800,SCREEN_HEIGHT-220,55,30],
[800,SCREEN_HEIGHT-160,55,20],
[800,SCREEN_HEIGHT-620,55,30],
[800,SCREEN_HEIGHT-560,55,20]
]
L = [self.level[0],self.level[2]]
for platform in L:
k = platform[3]
for i in range(platform[1]/16):
block = Platform()
block.rect.x = platform[2]
block.rect.y = k
self.platform_list.add(block)
k+=16
__level = [self.level[1],self.level[3]]
for i in self.obstacles:
__level.append(i)
for platform in __level:
__k = platform[2]
for i in range(platform[0]/16):
block = Platform()
block.rect.x = __k
block.rect.y = platform[3]
block.player = self.player
self.platform_list.add(block)
__k+=16
for ladder in self.ladders:
block = Ladders(ladder[2],ladder[3])
block.rect.x = ladder[0]
block.rect.y = ladder[1]
self.ladder_list.add(block)