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


Python Label.do方法代码示例

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


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

示例1: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
 def __init__(self, scene):
     from cocos.text import Label
     from cocos.actions import FadeIn
     from zombie.constants import VERSION
     
     super(TitleScreen, self).__init__()
     
     self.scene = scene
     
     title_label = Label(
         'Zombie+ Ultra',
         font_name='Extrude',
         font_size=48,
         anchor_x='center',
         anchor_y='center',
     )
     
     version_label = Label(
         VERSION,
         font_name='TinyUnicode',
         font_size=32,
         anchor_x='center',
     )
     
     title_label.position = 320, 240
     version_label.position = 320, (240 / 4) * 3
     title_label.do(FadeIn(duration=10))
     version_label.do(FadeIn(duration=10))
     
     self.add(title_label)
     self.add(version_label)
开发者ID:MagicPwn,项目名称:ZombiePlusUltra,代码行数:33,代码来源:client.py

示例2: TestLayer

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
class TestLayer(cocos.layer.Layer):
    def __init__(self):
        super( TestLayer, self ).__init__()

        x,y = director.get_window_size()
        self.color = [127, 127, 127, 255]

        self.label = Label(time.ctime(), (x/2, y/2))
        self.label.do( Rotate( 360, 10 ) )
        self.add( self.label  )

        self.schedule_interval(self.update_time, .1)

    def update_time(self, dt):
        self.label.element.text = time.ctime()
        self.color[:3] = [self._change_color(self.color[i]) for i in range(3)]
        self.label.element.color = self.color

    def _change_color(self, old_color):
        new_color = old_color + random.randint(-10, 10)
        if new_color > 255:
            new_color = 255
        if new_color < 0:
            new_color = 0
        return new_color
开发者ID:adamwiggins,项目名称:cocos2d,代码行数:27,代码来源:test_label_changing.py

示例3: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
	def __init__(self):
		super().__init__()

		width, height = director.get_window_size()
		paused = Label(_("PAUSE"), font_name="Ubuntu", font_size=64, bold=True,
		               color=Options.FONT_COLOR, anchor_x="center", anchor_y="center")
		paused.position = width // 2, height // 2
		paused.do(Repeat(FadeOut(0.3) + FadeIn(0.3)))  # blink
		self.add(paused)
开发者ID:brunonova,项目名称:collision,代码行数:11,代码来源:pause.py

示例4: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
    def __init__( self, win = False):
        super(GameOver,self).__init__( 32,32,32,64)

        w,h = director.get_window_size()

        if win:
            soundex.play('oh_yeah.mp3')
            msg = 'YOU WIN'
        else:
            soundex.play('no.mp3')
            msg = 'GAME OVER'

        label = Label(msg,
                    font_name='Edit Undo Line BRK',
                    font_size=54,
                    anchor_y='center',
                    anchor_x='center' )
        label.position =  ( w/2.0, h/2.0 )

        self.add( label )

        angle = 5
        duration = 0.05
        accel = 2
        rot = Accelerate(Rotate( angle, duration//2 ), accel)
        rot2 = Accelerate(Rotate( -angle*2, duration), accel)
        effect = rot + (rot2 + Reverse(rot2)) * 4 + Reverse(rot)
        
        label.do( Repeat( Delay(5) + effect ) )

        if hiscore.hiscore.is_in( status.status.score ):
            self.hi_score = True

            label = Label('Enter your name:',
                        font_name='Edit Undo Line BRK',
                        font_size=36,
                        anchor_y='center',
                        anchor_x='center',
                        color=(32,32,32,255),
                        )
            label.position =  ( w/2.0, h/2.0 )
            label.position = (w//2, 300)
            self.add( label )

            self.name= Label('',
                        font_name='Edit Undo Line BRK',
                        font_size=36,
                        anchor_y='center',
                        anchor_x='center',
                        color=(32,32,32,255),
                        )
            self.name.position=(w//2,250)
            self.add(self.name)
        else:
            self.hi_score = False
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:57,代码来源:gameover.py

示例5: MessageLayer

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
class MessageLayer(Layer):
    def show_message(self, message, callback=None):
        width, height = director.get_window_size()
        self.message = Label(message, 
                             font_size=52,
                             font_name='Times New Roman',
                             anchor_x='center',
                             anchor_y='center')
        self.message.position = (width/2.0, height)
        self.add(self.message)
        
        actions = Accelerate(MoveBy( (0,-height/2.0), duration=0.5)) + \
                    Delay(1) +  \
                    Accelerate(MoveBy( (0,-height/2.0), duration=0.5)) + \
                    Hide()
        if callback:
            actions += CallFunc( callback )
        self.message.do( actions )
开发者ID:mcgillij,项目名称:pygauntlet,代码行数:20,代码来源:gamelayers.py

示例6: TestLayer

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
class TestLayer(cocos.layer.Layer):
    def __init__(self):
        super( TestLayer, self ).__init__()

        x,y = director.get_window_size()
        self.color1 = [255, 0, 0, 255]
        self.color2 = [0, 0, 255, 255]

        self.label = Label('', (x//2, y//2))
        self.label.do( Rotate( 360, 10 ) )
        self.label.do( Repeat( Delay(1) + CallFunc(self.set_color, 0) +
                               Delay(1) + CallFunc(self.set_color, 1) +
                               Delay(1) + CallFunc(self.set_color, 2)
                              )) 
        self.add(self.label)
        self.set_color(2)

    def set_color(self, color_selector):
        colors = [ (255, 32, 64, 255), (0, 240, 100, 255), (90, 90, 250, 255) ]
        color = colors[color_selector]
        text = "(%s, %s, %s, %s)"%color
        self.label.element.text = text
        self.label.element.color = color
开发者ID:eevee,项目名称:cocos2d-mirror,代码行数:25,代码来源:test_label_changing.py

示例7: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
    def __init__(self, win):
        super(GameOver, self).__init__(32, 32, 32, 64)
        width, height = director.get_window_size()

        if win == 'win':
            #play win sound
            msg = 'You win!'
        elif win == 'lose':
            #play fail sound
            msg = 'Game Over Man!'
        else: #tie
            print "tie"
            msg = 'Tie! Awe Muffin!'

        label = Label(msg, font_name='Times New Roman', font_size=54, anchor_x='center', anchor_y='center')
        label.position = (width/2.0, height/2.0)
        self.add(label)
        angle = 5
        duration = 0.05
        accel = 2
        rotation = Accelerate(Rotate(angle, duration//2), accel)
        rotation2 = Accelerate(Rotate(-angle*2, duration), accel)
        effect = rotation + (rotation2 + Reverse(rotation2)) * 4 + Reverse(rotation)
        label.do(Repeat(Delay(5) + effect))
开发者ID:mcgillij,项目名称:pyglet_mvc_rps,代码行数:26,代码来源:gameover.py

示例8: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
	def __init__(self, message):
		"""Initialize an error layer."""
		super(ErrorLayer, self).__init__()
		w, h = director.get_window_size()
		
		lbl_title = Label("Fatal Error", bold=True, font_size=64, anchor_x="center", anchor_y="center", color=(255,255,255,0))
		lbl_title.position = w * 0.5, h * 0.75
		lbl_title.do(FadeIn(1))
		self.add(lbl_title)
		
		lbl_message = Label(message, anchor_x="center", anchor_y="center", font_size=12, color=(255,255,255,0))
		lbl_message.position = w * 0.5, h * 0.5
		lbl_message.do(FadeIn(1))
		self.add(lbl_message)
		
		lbl_advice = Label("Please restart the application once you have fixed the problem.", font_size=10, anchor_x="center", anchor_y="center", color=(255,255,255,0))
		lbl_advice.position = w * 0.5, h * 0.25
		lbl_advice.do(Accelerate(FadeIn(3), 2))
		self.add(lbl_advice)
开发者ID:ice3,项目名称:Glovebox,代码行数:21,代码来源:errorlayers.py

示例9: __init__

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
    def __init__( self, win = False):
        super(GameOver,self).__init__( 32,32,32,64)

        w,h = director.get_window_size()

        self.win = win

        if win:
            soundex.play('sounds/you_win.mp3')
            msg = 'FART IN LOVE'
        else:
            soundex.play('sounds/game_over_01.mp3')
            msg = 'GAME OVER'

        label = Label(msg,
                    font_name=FONT_NAME,
                    font_size=54,
                    anchor_y='center',
                    anchor_x='center' )
        label.position =  ( w/2.0, h/2.0 )

        self.add( label )

        angle = 5
        duration = 0.05
        accel = 2
        rot = Accelerate(Rotate( angle, duration//2 ), accel)
        rot2 = Accelerate(Rotate( -angle*2, duration), accel)
        effect = rot + (rot2 + Reverse(rot2)) * 4 + Reverse(rot)
        
        label.do( Repeat( Delay(5) + effect ) )

        if hiscore.hiscore.is_in( state.score ):
            self.hi_score = True

            label = Label('Enter your name:',
                        font_name=FONT_NAME,
                        font_size=36,
                        anchor_y='center',
                        anchor_x='center',
                        color=(32,32,32,255),
                        )
            label.position =  ( w/2.0, h/2.0 )
            label.position = (w//2, 130)
            self.add( label )

            self.name= Label('',
                        font_name=FONT_NAME,
                        font_size=36,
                        anchor_y='center',
                        anchor_x='center',
                        color=(32,32,32,255),
                        )
            self.name.position=(w//2,80)
            self.add(self.name)
        else:
            self.hi_score = False

            if not self.win:
                label = Label("Press 'R' to restart level",
                            font_name=FONT_NAME,
                            font_size=18,
                            anchor_y='center',
                            anchor_x='center' )
                label.position =  ( w/2.0, 20 )
                self.add( label )
开发者ID:HieuLsw,项目名称:pedoman,代码行数:68,代码来源:gameover.py

示例10: _show_spell_label

# 需要导入模块: from cocos.text import Label [as 别名]
# 或者: from cocos.text.Label import do [as 别名]
 def _show_spell_label(self, user, spell):
     label = Label(spell, anchor_x="center", font_size=16, font_name=Globals.FONT_NAME)
     label.position = user.spellWheel.position[0]+Globals.LABEL_OFFSET[0],user.spellWheel.position[1]+Globals.LABEL_OFFSET[1]
     label.opacity = 0
     label.do(FadeIn(0.2) + Delay(1.0) + FadeOut(0.5) + Remove())
     self.add(label)
开发者ID:TheZoq2,项目名称:SummonerWars,代码行数:8,代码来源:EffectLayer.py


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