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


Python tile.Tile类代码示例

本文整理汇总了Python中tile.Tile的典型用法代码示例。如果您正苦于以下问题:Python Tile类的具体用法?Python Tile怎么用?Python Tile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: cmd_tile

    def cmd_tile(self):
        Tile.cmd_tile(self)

        if not self.root:
            self.root = LeafFrame(self, None, Container(self))

            active = self.monitor.get_active()

            if active:
                self.add(active)

            for win in self.monitor.iter_windows():
                if win != active:
                    self.add(win)
        else:
            self.promote()
            for child in self.root.childs():
                if child.cont.empty and not child.cont.win:
                    child.cont.set_window(force=True)

        self.root.moveresize(
            self.monitor.wa_x, self.monitor.wa_y,
            self.monitor.wa_width, self.monitor.wa_height
        )

        for win in self.iter_hidden():
            win.set_below(True)

        for child in self.root.childs():
            child.cont.window_below(False)
            child.reset_cycle()
开发者ID:Belluka,项目名称:pytyle,代码行数:31,代码来源:tile_manual.py

示例2: __init__

    def __init__(self, width, height, colony, food):
        self.width = width
        self.height = height
        self.colony = [
                        colony[0]*TILE_SIZE, colony[1]*TILE_SIZE,
                        TILE_SIZE, TILE_SIZE
                        ]
        self.food = food
        screen_size = [width*TILE_SIZE, height*TILE_SIZE]
        self.screen = pygame.display.set_mode(screen_size)
        self.screen.fill(WHITE)
        self.tiles = []
        self.ants = {}

        # Populate grid
        for w in range(0, width):
            for h in range(0, height):
                square = Tile(w*TILE_SIZE, h*TILE_SIZE)
                self.tiles.append(square)
                rect, color = square.render()
                pygame.draw.rect(self.screen, color, rect)
        # Place colony
        pygame.draw.rect(self.screen, GREEN, self.colony)
        # Place food
        food_pos = food['position']
        pile = [[food_pos[0]*TILE_SIZE+TILE_SIZE/2, food_pos[1]*TILE_SIZE],
                [food_pos[0]*TILE_SIZE, (food_pos[1]+1)*TILE_SIZE],
                [(food_pos[0]+1)*TILE_SIZE, (food_pos[1]+1)*TILE_SIZE]]
        pygame.draw.polygon(self.screen, YELLOW, pile)
        pygame.display.set_caption("Ant colony visualization")
        pygame.display.flip()
开发者ID:VasilSokolov,项目名称:ants_visualization,代码行数:31,代码来源:board.py

示例3: init

	def init(self,voice=1):
		if voice==1: super().init()
		self.bgColor = (255,255,255)
		self.count = 0
		self.sec = 0 
		self.min = 0
		self.timetext = "TIME : 0:00"
		self.timechange = False
		self.movechange = False
		self.mute = -1
		self.mode = "play"
		#self.mode = "solve"
		self.solvelist = [5,6,7,3,2,6,5,1,2,3,7]
		self.solvelist += [11,12,8,4,3,7,6,10,9]
		self.solvelist += [13,14,15,16,12,11,10,9,13,14,15,11]
		self.solvelist += [10,14,13,9,10,6,5,9,13,14,15]
		self.solveindex = len(self.solvelist)-1

		datastring = "1000\n"
		datastring += "1000\n"
		writeFile("game4data.txt",datastring)

		global curk,k
		curk,k = 16,16
		global pg,pp
		pg = [2,7,10,11,14]
		pp = [1,3,4,5,9,13]
		
		Gear.init()
		Tile.init()
		Pipe.init()

		self.win = False
		self.gears = pygame.sprite.Group()
		self.pipes = pygame.sprite.Group()

		self.gears.add(Gear(330-65,180+65,-1,0))
		self.gears.add(Gear(330+65*4,180,17,0,1))

		self.tiles = pygame.sprite.Group()

		for i in range(4):
			for j in range(4):
				x=330+65*j
				y=180+65*i
				num=j*4+i+1
				if num != curk: self.tiles.add(Tile(x,y,num))
				if num in pg: 
					self.gears.add(Gear(x,y,num,0))
				if num in pp:
					if num == 13:
						self.pipes.add(Pipe(x,y,num,4))
					elif num == 5:
						self.pipes.add(Pipe(x,y,num,5))
					else:
						self.pipes.add(Pipe(x,y,num,1))

		self.exit = 20
		self.exittype = 1
		self.timer = 15
开发者ID:igobble,项目名称:Fantastic-Gears,代码行数:60,代码来源:game4.py

示例4: init

	def init(self):
		super().init()
		self.bgColor = (255,255,255)
		self.count = 15
		self.sec = 0 
		self.min = 0
		self.timetext = "TIME : 0:00"
		self.moveup = False
		self.mute = -1

		global curk,k
		curk,k = 3,3
		global p
		p = [1,4,6,7,10,11,13,16]
		
		Gear.init()
		Tile.init()
		self.win = False
		self.gears = pygame.sprite.Group()
		self.gears.add(Gear(330,180+65*4,-1,1))
		self.gears.add(Gear(330+65*4,180,17,0))
		self.tiles = pygame.sprite.Group()

		for i in range(4):
			for j in range(4):
				x=330+65*j
				y=180+65*i
				num=j*4+i+1
				if num != curk: self.tiles.add(Tile(x,y,num))
				if num in p: 
					if num==4: 
						self.gears.add(Gear(x,y,num,1))	
					else:
						self.gears.add(Gear(x,y,num,0))
开发者ID:igobble,项目名称:Fantastic-Gears,代码行数:34,代码来源:game1move.py

示例5: cmd_untile

    def cmd_untile(self):
        Tile.cmd_untile(self)

        if self.store:
            for cont in self.store.all()[:]:
                cont.remove(reset_window=True)

            self.store.reset()
开发者ID:Belluka,项目名称:pytyle,代码行数:8,代码来源:tile_auto.py

示例6: tileClicked

 def tileClicked(self, x, y):
     tile = self.grid[x][y]
     if tile is None:
         tileID = self.takeCard()
         if (tileID is not None):
             tile = Tile(self.tileData[tileID], tileID, x, y, self.activePlayer)
             self.grid[x][y] = tile
     else:
         tile.rotate()
     self.calculatePower()
开发者ID:FluxDenisty,项目名称:tile-powered-machine,代码行数:10,代码来源:game.py

示例7: init

	def init(self,voice=1):
		if voice==1: super().init()
		self.bgColor = (255,255,255)
		self.count = 0
		self.sec = 0 
		self.min = 0
		self.timetext = "TIME : 0:00"
		self.timechange = False
		self.movechange = False
		self.mute = -1
		self.mode = "play"
		#self.mode = "solve"
		self.solvelist = [11,10,9,13,14,10,11,7,6,10,11,12,8]
		self.solvelist += [7,3,2,6,10,11,12,8,7,3]
		self.solveindex = len(self.solvelist)-1

		datastring = "1000\n"
		datastring += "1000\n"
		writeFile("game5data.txt",datastring)

		global curk,k
		curk,k = 4,4
		global p3,p6
		p3 = [1,2,3,5,6,9]
		p6 = [8,11,12,14,15,16]
		
		Pipe.init()
		Tile.init()
		Gear.init()

		self.win = False
		self.pipes = pygame.sprite.Group()
		self.tiles = pygame.sprite.Group()
		self.gears = pygame.sprite.Group()

		self.gears.add(Gear(330+65*3+5,180-55,-1,0,1))
		
		for i in range(4):
			for j in range(4):
				x=332+65*j
				y=180+65*i
				num = j*4+i+1
				if num in p3:
					self.pipes.add(Pipe(x,y,num,3))
				elif num in p6:
					self.pipes.add(Pipe(x,y,num,6))
				elif num!= curk:
					self.tiles.add(Tile(x,y,num))

		self.exit = 0
		self.exittype = 6
		self.timer = 15
		self.gassound = pygame.mixer.Sound('sound/gas01.wav')
		self.gassound.play()
		self.gassound.set_volume(0.2)
开发者ID:igobble,项目名称:Fantastic-Gears,代码行数:55,代码来源:game5.py

示例8: init

	def init(self):
		super().init()
		self.bgColor = (255,255,255)
		self.count = 0
		self.sec = 3100
		self.min = 0
		self.timetext = "TIME : 0:30"
		self.timeup = False
		self.mute = -1

		global curk,k
		curk,k = 4,4
		global p1,p2,p3,p4,p5,p6,p7
		p1 = [5,7,10,12,15]
		p2 = [8,9]
		p3 = [14]
		p4 = []
		p5 = [3]
		p6 = [2]
		p7 = [6,11]
		
		Pipe.init()
		Tile.init()
		Gear.init()

		self.win = False
		self.pipes = pygame.sprite.Group()
		self.tiles = pygame.sprite.Group()
		self.gears = pygame.sprite.Group()

		self.gears.add(Gear(330+65*3+5,180-55,-1,0))

		for i in range(4):
			for j in range(4):
				x=332+65*j
				y=180+65*i
				num = j*4+i+1
				if num in p1: 
					self.pipes.add(Pipe(x,y,num,1))	
				elif num in p2:
					self.pipes.add(Pipe(x,y,num,2))
				elif num in p3:
					self.pipes.add(Pipe(x,y,num,3))
				elif num in p4:
					self.pipes.add(Pipe(x,y,num,4))
				elif num in p5:
					self.pipes.add(Pipe(x,y,num,5))
				elif num in p6:
					self.pipes.add(Pipe(x,y,num,6))
				elif num in p7:
					self.pipes.add(Pipe(x,y,num,7))
				elif num!= curk:
					self.tiles.add(Tile(x,y,num))

		self.timer = 15
开发者ID:igobble,项目名称:Fantastic-Gears,代码行数:55,代码来源:game7timing.py

示例9: TestTile

class TestTile(unittest.TestCase):

    def setUp(self):
        pygame.init()
        self.screen = pygame.display.set_mode((32, 32))
        self.tile = Tile(0, 0, 'data/tiles/wall.png', self.screen, (32, 32))

    def test_blitting(self):
        self.tile.update()
        pygame.display.flip()
        pygame.time.Clock().tick(2)
开发者ID:xswordsx,项目名称:Finn-Bardi,代码行数:11,代码来源:test_tile.py

示例10: __init__

 def __init__(self, element, xoffset = 0.0, yoffset = 0.0, level=0):
     QObject.__init__(self)
     Tile.__init__(self, element)
     self.__board = None
     self.graphics = GraphicsTileItem(self)
     self.__xoffset = xoffset
     self.__yoffset = yoffset
     self.__dark = False
     self.level = level
     self.activeAnimation = dict() # key is the property name
     self.queuedAnimations = []
开发者ID:ospalh,项目名称:kajongg-fork,代码行数:11,代码来源:uitile.py

示例11: __init__

    def __init__(self, tile, source, game):
        super(Character, self).__init__(source=source, pos=(Tile.get_tile(tile).x, Tile.get_tile(tile).y))
        self.speed_x, self.speed_y = CHAR_SPEED_X, CHAR_SPEED_Y
        self.deacc = CHAR_DEACCELERATION
        self.velocity_x = 0
        self.velocity_y = 0
        self.tile = tile
        self.game = game
        self.moving = False

        self.game.add_widget(self)
开发者ID:Catagen,项目名称:boxo,代码行数:11,代码来源:objects.py

示例12: __init__

    def __init__(self):
        super(Game, self).__init__()

        self.level = Level(1, [10,11,12,25], [11,12])
        Tile.make_tiles(self.size, self.level)

        self.background = Background(source='img/background.png')
        self.size = self.background.size
        self.add_widget(self.background)
        self.character = Character(pos=(20, self.height/2))
        self.add_widget(self.character)
        Clock.schedule_interval(self.update, 1.0/60.0)
开发者ID:Catagen,项目名称:boxo,代码行数:12,代码来源:main2.py

示例13: cmd_untile

    def cmd_untile(self):
        assert self.root

        Tile.cmd_untile(self)

        for win in self.iter_hidden():
            win.set_below(False)

        for child in self.root.childs():
            child.cont.remove(reset_window=True)

        self.root = None
开发者ID:Belluka,项目名称:pytyle,代码行数:12,代码来源:tile_manual.py

示例14: buildtile

def buildtile(args):
    """Given a region name and coordinates, build the corresponding tile."""
    # this should work for single and multi threaded cases
    (log, name, tilex, tiley) = args
    log.log_debug(1,"Building tile (%d,%d) of map %s..." % \
                    (tilex, tiley, name))
    yamlfile = file(os.path.join('Regions', name, 'Region.yaml'))
    myRegion = yaml.load(yamlfile)
    yamlfile.close()
    myTile = Tile(myRegion, tilex, tiley)
    myTile.log = log
    myTile()
开发者ID:KermMartian,项目名称:TopoMC,代码行数:12,代码来源:BuildRegion.py

示例15: __init__

    def __init__(self, level):
        super(Game, self).__init__()
        self.level = Level.load_level(level)
        self.background = Sprite(source='img/background.PNG')
        self.size = self.background.size
        self.player = None
        self.boxes = []

        # Initiate the game by creating tiles
        Tile.make_tiles(self.size, self.level)

        # Add bg widget first to not cover other sprites
        self.add_widget(self.background)

        # Add proper widgets for every non-empty tile in the Tile.List
        for tile in Tile.List:
            if tile.type != 'empty':
                if Tile.get_tile(tile.number - Tile.V).walkable:
                    self.add_widget(Sprite(
                        source=Tile.image_files[tile.type],
                        pos=(tile.x, tile.y)), index=2)
                else:
                    self.add_widget(Sprite(
                        source=Tile.image_files[tile.type + '_edge'],
                        pos=(tile.x, tile.y - SPRITE_EDGE_OFFSET)))

        for tile in self.level.boxspawn:
            self.boxes.append(Box(tile, self))

        self.player = Player(self.level.playerspawn, self)

        self.fps_lab = Label(
            text='FPS: ' + str(Clock.get_rfps()),
            pos=(2, self.height - 110),
            font_name=APP_FONT,
            font_size=18,
            color=(240, 240, 240, 0.8))

        self.add_widget(self.fps_lab)

        self.add_widget(Label(
            text="Level {}".format(self.level.level),
            pos=(0, self.height - 80),
            font_name=APP_FONT,
            font_size=18,
            color=(240, 240, 240, 0.8)))

        # Schedule an interval for the game update function
        Clock.schedule_interval(self.update, 1.0/60.0)
开发者ID:Catagen,项目名称:boxo,代码行数:49,代码来源:main.py


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