本文整理汇总了Python中Level.Level.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Level.__init__方法的具体用法?Python Level.__init__怎么用?Python Level.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level.Level
的用法示例。
在下文中一共展示了Level.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player, active_sprite_list):
""" Create level 1. """
# Call the parent constructor
Level.__init__(self, player, self._BACKGROUND_IMAGE)
self.show_text(self._INTRO_TEXT)
self.active_sprite_list = active_sprite_list
self.level_limit = -1000
# Array with type of platform, and x, y location of the platform.
level = [
[210, 30, 450, 500],
[210, 30, 850, 500],
[210, 30, 1000, 500],
]
# Go through the array above and add platforms
for platform in level:
block = Platform()
block.rect.x = platform[2]
block.rect.y = platform[3]
block.player = self.player
self.platform_list.add(block)
toots = Toots(player, self.active_sprite_list)
toots.level = self
toots.rect.x = 1000
toots.rect.y = SCREEN_HEIGHT + 100
self.enemy_list = pygame.sprite.Group()
self.enemy_list.add(toots)
示例2: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, director, player):
Level.__init__(self, director, player)
self.player.rect.x = 766
self.player.rect.y = 82
self.enemyGroup.add([Nazist(640, 140, self.player, director),
# Nazist(640, 176, self.player, director),
# Nazist(688, 18, self.player, director),
Nazist(524, 51, self.player, director),
# Nazist(524, 140, self.player, director),
Nazist(345, 46, self.player, director),
Nazist(345, 70, self.player, director),
# Nazist(345, 100, self.player, director),
Nazist(140, 145, self.player, director),
Nazist(140, 175, self.player, director),
Nazist(185, 10, self.player, director),
Mr_H(27, 48, self.player, director)])
self.bg = load_image("mapa_h.png", Constants.MAP_DIR)
self.collisionBg = load_image("mapa_h_bg.png", Constants.BG_MAP_DIR)
load_music("level_three.xm")
pygame.mixer.music.set_volume(0.25)
pygame.mixer.music.play(-1)
player.setWeapons([WpnGrenade(), WpnRifle()])
示例3: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, width, height):
Level.__init__(self, width, height)
##initialize blocks##
boxtop = Terrain(20, -19, 40, 2, 0, 0,100, self, 0.5)
boxleft= Terrain(-1,-5,2,30,0,0,100,self,0.5)
boxbottom= Terrain(27.0,9.0,54.0,2.0,0.0,0.0,100,self,0.5)
boxright= Terrain(55,-5,2,30,0,0,100,self,0.5)
goal= Goal(53,5,1,5,0,0,100,self,0.5)
b = Block(2, 2, 4, 1, 0, 0, 1, self, 0.5)
c = Player(7, 5, 1, 2, 0, 0, 1, self, 0.5)
d = Block(4, 2, 4, 1, 0, 5, 2, self, 0.5)
a = GoalBlock(4, 5, 2, 2, 0, 5, 2, self, 0.5)
m = Trampoline(30, -4, 2, 1, 0, 0, 1, self, 0.5)
e = Spike(30.0, 7.5, 41.0, 1.0, 0.0, 0.0, 100, self, 0.1)
f = Spike(29.0, 6.5, 1.0, 1.0, 0.0, 0.0, 100, self, 0.1)
self.add_elem(c)
self.add_elem(m)
self.add_elem(b)
self.add_elem(a)
self.add_elem(d)
self.add_elem(e)
self.add_elem(f)
self.add_elem(boxtop)
self.add_elem(boxright)
self.add_elem(boxbottom)
self.add_elem(boxleft)
self.add_elem(goal)
示例4: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, director, player):
Level.__init__(self, director, player)
self.player.rect.x = 782
self.player.rect.y = 912
self.dead_sub_boss = 0 #Counts the dead Centurions.
self.enemyGroup.add([Legionnaire(987, 768, self.player, director),
Legionnaire(1083, 768, self.player, director),
Legionnaire(1119, 768, self.player, director),
Legionnaire(987, 834, self.player, director),
Legionnaire(477, 747, self.player, director),
Legionnaire(645, 738, self.player, director),
Legionnaire(477, 891, self.player, director),
Legionnaire(645, 788, self.player, director),
Centurion(150, 288, self.player, director),
Centurion(1455, 288, self.player, director),
Centurion(1329, 1248, self.player, director)])
self.door = Door(760, 575, 'door_sheet.png', -1, 'coordDoor.txt', [2], 'door_open.wav')
self.doorGroup = EntityGroup([])
self.doorGroup.add(self.door)
self.groups.append(self.doorGroup)
self.bg = load_image("map_caesar_a_img.png", Constants.MAP_DIR)
self.collisionBg = load_image(
"map_caesar_a_bg.png", Constants.BG_MAP_DIR)
load_music("level_one.it")
pygame.mixer.music.set_volume(1)
pygame.mixer.music.play(-1)
player.setWeapons([WpnBlade("wpns2.png", -1, pygame.Rect(344, 342, 28, 28), "blade_swing.wav", 0.5), \
WpnBow("items-1.png", None, pygame.Rect(0, 24, 24, 24))])
示例5: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
""" Create level 1. """
# Call the parent constructor
Level.__init__(self, player, self._BACKGROUND_IMAGE)
self.player = player
self.show_text(self._INTRO_TEXT)
self.level_limit = -1000
# Array with width, height, x, and y of platform
level = [[210, 70, 500, 500],
[210, 70, 800, 400],
[210, 70, 1000, 500],
[210, 70, 1120, 280],
]
# Go through the array above and add platforms
for platform in level:
block = Platform()
block.rect.x = platform[2]
block.rect.y = platform[3]
block.player = self.player
self.platform_list.add(block)
self.enemy_list = pygame.sprite.Group()
self.make_n_random_enemies(2)
示例6: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
Level.__init__(self, player)
self.init_enemies()
self.init_items()
self.PLAYER_START = [72, 57]
self.is_beatable = False
self.init_labels()
示例7: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, width, height):
Level.__init__(self, width, height)
##initialize blocks##
boxtop = Terrain(20, -19, 40, 2, 0, 0,100, self, 0.5)
boxleft= Terrain(-1,-5,2,30,0,0,100,self,0.5)
boxbottom= Terrain(20,9,40,2,0,0,100,self,0.5)
boxright= Terrain(41,-5,2,30,0,0,100,self,0.5)
barrbottom = Terrain(15,-6,6,1,0,0,100,self,.5)
barrright = Terrain(18.5,-11,1,10,0,0,100,self,.5)
goal= Goal(38,-15.5,1,5,0,0,100,self,0.5)
tramp1= Trampoline(7,7,6,1,0,0,100,self,.5)
tramp2= Trampoline(36,7,6,1,0,0,100,self,.5)
tramp3= Trampoline(32,-8,6,1,0,0,100,self,.5)
tramp4= Trampoline(36,-23,6,1,0,0,100,self,.5)
p = Player(2, 5, 1, 2, 0, 0, 1, self, 0.5)
g = GoalBlock(16.5, -7, 2, 2, 0, 0, 2, self, 0.5)
self.add_elem(p)
self.add_elem(barrbottom)
self.add_elem(barrright)
self.add_elem(tramp1)
self.add_elem(tramp2)
self.add_elem(tramp3)
self.add_elem(tramp4)
self.add_elem(g)
self.add_elem(boxtop)
self.add_elem(boxright)
self.add_elem(boxbottom)
self.add_elem(boxleft)
self.add_elem(goal)
示例8: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, width, height):
Level.__init__(self, width, height)
##initialize blocks##
boxtop = Terrain(20, -19, 40, 2, 0, 0,100, self, 0.5)
boxleft= Terrain(-1,-5,2,30,0,0,100,self,0.5)
boxbottom= Terrain(20,9,40,2,0,0,100,self,0.5)
boxright= Terrain(41,-5,2,30,0,0,100,self,0.5)
goal= Goal(38,5,1,5,0,0,100,self,0.5)
b10 = Block(1, 7, 2, 2, 0, 0, 1, self, 0.5)
b20 = Block(3, 7, 2, 2, 0, 0, 1, self, 0.5)
b30 = Block(5, 7, 2, 2, 0, 0, 1, self, 0.5)
b40 = Block(7, 7, 2, 2, 0, 0, 1, self, 0.5)
b50 = Block(9, 7, 2, 2, 0, 0, 1, self, 0.5)
b11 = Block(1, 5, 2, 2, 0, 0, 1, self, 0.5)
b21 = Block(3, 5, 2, 2, 0, 0, 1, self, 0.5)
b31 = Block(5, 5, 2, 2, 0, 0, 1, self, 0.5)
b41 = Block(7, 5, 2, 2, 0, 0, 1, self, 0.5)
b51 = Block(9, 5, 2, 2, 0, 0, 1, self, 0.5)
b12 = Block(1, 3, 2, 2, 0, 0, 1, self, 0.5)
b22 = Block(3, 3, 2, 2, 0, 0, 1, self, 0.5)
b32 = Block(5, 3, 2, 2, 0, 0, 1, self, 0.5)
b42 = Block(7, 3, 2, 2, 0, 0, 1, self, 0.5)
b52 = Block(9, 3, 2, 2, 0, 0, 1, self, 0.5)
p = Player(15, 5, 1, 2, 0, 0, 1, self, 0.5)
g = GoalBlock(17, 5, 2, 2, 0, 0, 2, self, 0.5)
barrier = Terrain(35,-3,1,22,0,0,100,self,0.5)
self.add_elem(p)
self.add_elem(b10)
self.add_elem(b20)
self.add_elem(b30)
self.add_elem(b40)
self.add_elem(b50)
self.add_elem(b11)
self.add_elem(b21)
self.add_elem(b31)
self.add_elem(b41)
self.add_elem(b51)
self.add_elem(b12)
self.add_elem(b22)
self.add_elem(b32)
self.add_elem(b42)
self.add_elem(b52)
self.add_elem(barrier)
self.add_elem(g)
self.add_elem(boxtop)
self.add_elem(boxright)
self.add_elem(boxbottom)
self.add_elem(boxleft)
self.add_elem(goal)
示例9: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, director, player):
Level.__init__(self, director, player)
self.player.rect.x = 381
self.player.rect.y = 610
self.enemyGroup.add([Legionnaire(207, 447, self.player, director),
Legionnaire(592, 447, self.player, director),
Caesar(399, 336, self.player, director)])
self.bg = load_image("map_caesar_b_img.png", Constants.MAP_DIR)
self.collisionBg = load_image(
"map_caesar_b_bg.png", Constants.BG_MAP_DIR)
load_music("level_one.it")
pygame.mixer.music.set_volume(1)
pygame.mixer.music.play(-1)
示例10: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
Level.__init__(self, player)
self.init_enemies()
self.init_items()
self.PLAYER_START = [105.2, 40]
self.player.set_direction("up")
self.is_beatable = False
self.init_labels()
self.time_between_fireballs = 0
self.checkpoint = 0
self.has_gotten_checkpoint_1 = False
self.has_gotten_checkpoint_2 = False
self.has_gotten_checkpoint_3 = False
self.fireball_strength = 2
self.timer = 0
self.beaten = False
示例11: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, director, player):
Level.__init__(self, director, player)
self.player.rect.x = 224
self.player.rect.y = 1273
self.laser0 = Laser(80, 340, 'laser_45.png')
self.laser1 = Laser(400, 75, 'laser_45.png')
self.laser2 = Laser(405, 332, 'laser_180.png')
self.laser3 = Laser(80, 330, 'laser_180.png')
self.laser4 = Laser(406, 341, 'laser_125.png')
self.laser5 = Laser(80, 80, 'laser_125.png')
self.laser6 = Laser(400, 350, 'laser_90.png')
self.laserArray = [self.laser0, self.laser1, self.laser2, self.laser3, self.laser4, self.laser5, self.laser6]
self.laserGroup = EntityGroup([])
self.laserGroup.add(self.laser0, self.laser1, self.laser2,self.laser3, self.laser4, self.laser5, self.laser6)
self.groups.append(self.laserGroup)
self.laser0.active = False
self.laser1.active = False
self.activeLG = 1 #Pair of lasers active at a given time
self.time = 0
self.page = Page(408, 135, self.player, director)
self.enemyGroup.add([FutureSoldier(141, 1084, self.player, director),
FutureSoldier(316, 1084, self.player, director),
FutureSoldier(141, 926, self.player, director),
FutureSoldier(316, 926, self.player, director),
FutureSoldier(686, 1260, self.player, director),
FutureSoldier(508, 988, self.player, director),
FutureSoldier(537, 1450, self.player, director),
self.page])
self.bg = load_image("map_page_img.png", Constants.MAP_DIR)
self.collisionBg = load_image("map_page_bg.png", Constants.BG_MAP_DIR)
self.invisibleFloor = InvisibleFloor(384,202,59,78) #Invisible sprite, it functions as a trigger
self.invisibleFloorG = EntityGroup([])
self.invisibleFloorG.add(self.invisibleFloor)
self.groups.append(self.invisibleFloorG)
load_music("level_four.s3m")
pygame.mixer.music.set_volume(0.5)
pygame.mixer.music.play(-1)
player.setWeapons([WpnBlade("lightsaber.png", -1, pygame.Rect(128, 77, 42, 42), "sthswng1.wav", 0.2), \
WpnLaser()])
示例12: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
Level.__init__(self, player)
self.init_enemies()
self.init_items()
self.PLAYER_START = [104, 78]
self.is_beatable = False
self.init_labels()
self.time_between_fireballs = 0
self.checkpoint = 0
self.has_gotten_checkpoint_1 = False
self.has_gotten_checkpoint_2 = False
self.has_gotten_checkpoint_3 = False
self.fireball_strength = 2
self.timer = 0
#Counts number of kegs the player has killed
self.kegs = 0
self.player.inventory.append("fireball")
self.has_fireball = True
示例13: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, w, h, filename, data_path):
#If a blank filename is passed, create a new level file 'new_level_1.ini, if the file exists in level_data,
#increment i until a filename that does not exist in working dir is found
if os.path.isfile(os.path.join(data_path, 'level_data', filename)):
print("Existing level found, loading..")
else:
if filename is "":
i = 0
while True:
i += 1
filename = 'new_level_' + str(i) + '.ini'
if not os.path.isfile(os.path.join(data_path, 'level_data', filename)):
break
Level.__init__(self, w, h, filename, data_path)
self.selected_obj = None
self.camera = EditCamera(800, 600, 2000, 800)
#offsets from selected object's top left corner to mouse at time of selection
self._sel_m_x = 0
self._sel_m_y = 0
self._menu_focus = False
self.sel_target = SelectionTarget(data_path)
level_options = GuiLevelOptions(False)
quit_lvl_gui = GuiQuitLevel(False)
obj_search_gui = GuiObjSearch(False)
edit_obj_gui = GuiEditObj(True)
self.gui_manager.add(QUIT_GAME, quit_lvl_gui)
self.gui_manager.add(OBJECT_SEARCH, obj_search_gui)
self.gui_manager.add(LEVEL_OPTIONS, level_options)
self.gui_manager.add(EDIT_OBJ, edit_obj_gui)
self.del_bind = pygame.K_d
self.edit_bind = pygame.K_e
self.options_bind = pygame.K_F1
self.spawn_bind = pygame.K_SPACE
#1 = left mouse button
self.sel_bind = 1
示例14: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
""" Create level 1. """
# Call the parent constructor
Level.__init__(self, player)
self.level_limit = -1000
# Array with type of platform, and x, y location of the platform.
level = [[210, 30, 450, 570],
[210, 30, 850, 420],
[210, 30, 1000, 520],
[210, 30, 1120, 280],
]
# Go through the array above and add platforms
for platform in level:
block = Platform(platform[0], platform[1])
block.rect.x = platform[2]
block.rect.y = platform[3]
block.player = self.player
self.platform_list.add(block)
示例15: __init__
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import __init__ [as 别名]
def __init__(self, player):
Level.__init__(self, player, self._BACKGROUND_IMAGE)
self.level_limit = -100
self.show_text(self._INTRO_TEXT)