本文整理汇总了Python中cocos.scene.Scene.do方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.do方法的具体用法?Python Scene.do怎么用?Python Scene.do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos.scene.Scene
的用法示例。
在下文中一共展示了Scene.do方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cocos.scene import Scene [as 别名]
# 或者: from cocos.scene.Scene import do [as 别名]
def main():
print(description)
director.init( resizable=True, width=640, height=480 )
scene_green = Scene()
layer_green = ColorLayer(32,255,0,255)
scene_green.add(layer_green)
scene_green.do(ac.Delay(2.0) + ac.CallFunc(push_sequence_scene))
# pyglet 1.1.4 needs this to timely pump actions
pyglet.clock.schedule(lambda dt: None)
director.run(scene_green)
示例2: push_sequence_scene
# 需要导入模块: from cocos.scene import Scene [as 别名]
# 或者: from cocos.scene.Scene import do [as 别名]
def push_sequence_scene():
scene_blue = Scene()
layer_blue = ColorLayer(32,32,255,255)
scene_blue.add( layer_blue, z=0 )
scene_blue.do(ac.Delay(2) + ac.CallFunc(pop_scene))
scene_red = Scene()
layer_red = ColorLayer(255,32,0,255)
scene_red.add( layer_red, z=0 )
scene_red.do(ac.Delay(2) + ac.CallFunc(pop_scene))
director.push( SequenceScene(scene_blue, scene_red) )
示例3: Scene
# 需要导入模块: from cocos.scene import Scene [as 别名]
# 或者: from cocos.scene.Scene import do [as 别名]
scene = Scene(BackgroundLayer())
# create a Lens effect action
# radius: 150 pixels
# lens_effect: 0.7, a strong "lens". 0 means no effect at all. 1 means very strong
# center: center of the lens
# grid=(20,16): create a grid of 20 tiles x 16 tiles. More tiles will
# look better but the performance will decraese
# duration=10: 10 seconds
lens = Lens3D(radius=150, lens_effect=0.7, center=(150, 150), grid=(20, 16), duration=50)
# create a Jump action
# Jump to the right 360 pixels doing:
# 3 jumps
# of height 170 pixels
# in 4 seconds
jump = JumpBy((360, 0), 170, 3, 4)
# do and get the cloned action of lens'
action = scene.do(lens)
# perform the Jump action using as target the lens effect.
# the Jump action will modify the 'position' attribute, and
# the lens action uses the 'position' attribute as the center of the lens
#
# The action Jump + Reverse(Jump) will be repeated 5 times
scene.do((jump + Reverse(jump)) * 5, target=action)
# Run!
director.run(scene)