当前位置: 首页>>代码示例>>Python>>正文


Python Loader.get方法代码示例

本文整理汇总了Python中loader.Loader.get方法的典型用法代码示例。如果您正苦于以下问题:Python Loader.get方法的具体用法?Python Loader.get怎么用?Python Loader.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在loader.Loader的用法示例。


在下文中一共展示了Loader.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parseCommand

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import get [as 别名]
    def parseCommand(self, usr, msg, chan):

        plgname = msg.split()[0].replace("!", "")
        plugins = Loader()
        for plugin in plugins.load():
            plg = plugins.get(plugin)

            if msg.startswith(("!" + plugin["name"])):
                args = msg.replace(("!" + plugin["name"]), "")
                self.current_chan = chan
                result = plg.do(args, coriolis=self)
                if result:
                    self.msg(chan, result)
开发者ID:Cameleopardus,项目名称:Coriolis,代码行数:15,代码来源:coriolis.py

示例2: create

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import get [as 别名]
	def create (self):
		
		self.player = Player(self.width/2, self.height - 2)
		self.player.offset_x = - 16
		self.player.offset_y = - 32
		
		self.maze = Maze(self.width, self.height, self.tile_size)
		self.maze.create()
		
		self.music = Loader.get('music')
		self.music.play(-1)
		
		if self.enable_sound:
			self.music.set_volume(0.2)
			
		else:
			self.music.set_volume(0)

		# black screen fade out
		self.fade_timer = Timer(2000)
		
		self.castle = Sprite(0, -16, 'castle')
		
		self.torches = []
		self.torches.append(Sprite(336, 80, 'torch'))
		self.torches.append(Sprite(480, 80, 'torch'))
		self.torches.append(Sprite(83, 140, 'flame'))
		
		self.lights = []
		self.lights.append(Sprite(240, 0, 'light'))
		self.lights.append(Sprite(384, 0, 'light'))
		self.lights.append(Sprite(-13, 58, 'light'))
		
		for t in self.torches:
			t.play('default', loop=True)
			
		for l in self.lights:
			l.play('default', loop=True)
		
		self.sound = Sprite(common.GAME_WIDTH - 80, 10, 'sound')
		self.nosound = Sprite(common.GAME_WIDTH - 80, 14, 'nosound')
		self.restart = Sprite(common.GAME_WIDTH - 70, 15, 'restart')
		
		self.fog = pygame.Surface((self.maze.image.get_width(), self.maze.image.get_height()))
		self.fog.set_colorkey((255, 0, 255))
开发者ID:thiagojobson,项目名称:Maze-Of-Kindred,代码行数:47,代码来源:main.py

示例3: __init__

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import get [as 别名]
	def __init__ (self, x, y, key):
	
		pygame.sprite.Sprite.__init__(self)
		
		self.x = x
		self.y = y
		
		self.offset_x = 0
		self.offset_y = 0
		
		self.key = key
		self.frames = Loader.get(key)
		self.anims = {}
		self.current_anim = 'default'
		self.anims['default'] = Animation(1000, self.frames)
		self.image = self.anims[self.current_anim].get_image()	
		
		self.rect = self.image.get_rect() 
		self.rect.x = x
		self.rect.y = y
开发者ID:thiagojobson,项目名称:Maze-Of-Kindred,代码行数:22,代码来源:sprite.py

示例4: create

# 需要导入模块: from loader import Loader [as 别名]
# 或者: from loader.Loader import get [as 别名]
	def create (self):
		
		cement = Loader.get('maze_cement') # cement tiles
		floor = Loader.get('maze_floor')   # floor tiles
		CEMENT_BASE_WALL = 0
		CEMENT_TOP_WALL = 1
		
		self.tiles = [
			cement[13], # CEMENT_BASE_WALL
			cement[10], # CEMMENT_TOP_WALL
			floor[13],  # FLOOR
			floor[14],
			floor[17],
			floor[18],
		]
		
		self.matrix = []
		self.graphics = []
		
		for i in range (0, self.height):
			self.matrix.append([])
			self.graphics.append([])
			for j in range (0, self.width):
				self.matrix[i].append(1)
				self.graphics[i].append(randint(2, 4))
			
		posX = self.height - 3
		posY = self.width/2
		
		self.matrix[posX][posY] = 0
		moves = []
		moves.append(posY + posX * self.width)
		
		while len(moves) > 0:
		
			possibleDirections = ""
			
			if posX + 3 > 0 and posX + 3 < self.height - 1 and self.matrix[posX + 3][posY] == 1:
				possibleDirections += 'S'
				
			if posX - 3 > 0 and posX - 3 < self.height - 1 and self.matrix[posX - 3][posY] == 1:
				possibleDirections += 'N'
			
			if posY - 2 > 0 and posY - 2 < self.width - 1 and self.matrix[posX][posY - 2] == 1:
				possibleDirections += 'W'
			
			if posY + 2 > 0 and posY + 2 < self.width - 1 and self.matrix[posX][posY + 2] == 1:
				possibleDirections += 'E'
			
			if len(possibleDirections) > 0:
			
				move = randint(0, len(possibleDirections) - 1)
				
				if possibleDirections[move] == 'N':
					
					self.matrix[posX - 3][posY] = 0
					self.matrix[posX - 2][posY] = 0
					self.matrix[posX - 1][posY] = 0
					posX -= 3
				
				elif possibleDirections[move] == 'S':
				
					self.matrix[posX + 3][posY] = 0
					self.matrix[posX + 2][posY] = 0
					self.matrix[posX + 1][posY] = 0
					posX += 3
					
				elif possibleDirections[move] == 'W':

					self.matrix[posX][posY - 2] = 0
					self.matrix[posX][posY - 1] = 0
					posY -= 2
					
				elif possibleDirections[move] == 'E':
				
					self.matrix[posX][posY + 2] = 0
					self.matrix[posX][posY + 1] = 0
					posY += 2
			
				moves.append(posY + posX * self.width)
				
			else:			
				back = moves.pop(-1)
				posX = int(back / self.width)
				posY = back % self.width
		
		# erase lines (walls) in castle area and beginning area
		for i in range (0, 11):
			for j in range (1, self.width - 1):
				
				_i = min(i, 1)
				self.matrix[i][j] = 0
				self.matrix[-_i - 2][j] = 0
					
		# build graphics
		for i in range (0, self.height - 1):
			for j in range (0, self.width):
			
				if self.matrix[i][j] == 1:
					if self.matrix[i+1][j] == 1:
#.........这里部分代码省略.........
开发者ID:thiagojobson,项目名称:Maze-Of-Kindred,代码行数:103,代码来源:maze.py


注:本文中的loader.Loader.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。