def game_over():
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    text = cocos.text.Label('Game Over', position=(w*0.5, h*0.5),
                            font_name='Oswald', font_size=72,
                            anchor_x='center', anchor_y='center')
    layer.add(text)
    scene = cocos.scene.Scene(layer)
    new_scene = FadeTransition(mainmenu.new_menu())
    func = lambda: director.replace(new_scene)
    scene.do(ac.Delay(3) + ac.CallFunc(func))
    return scene
def game_over():
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    text = cocos.text.Label('Game Over', position=(w*0.5, h*0.5),
                            font_name='Oswald', font_size=72,
                            anchor_x='center', anchor_y='center')
    layer.add(text)
    scene = cocos.scene.Scene(layer)
    new_scene = FadeTransition(mainmenu.new_menu()) #FadeTransition轉場景特效
    func = lambda: director.replace(new_scene)
    scene.do(ac.Delay(3) + ac.CallFunc(func)) #如同在main.menu.py的self.create_menu所說,場景也可以做動作,故在3秒後才切換至新場景
    return scene
Exemple #3
0
def game_over():
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    text = cocos.text.Label('Game Over', position=(w/2, h/2),
            font_name='Oswald', font_size=72,
            anchor_x='center',
            anchor_y='center')
    layer.add(text)
    scene = cocos.scene.Scene(layer)
    new_scene = FadeTransition(mainmenu.new_menu())
    func = lambda: director.replace(new_scene)
    scene.do(ac.Delay(3)+ac.CallFunc(func))
    return scene
Exemple #4
0
def game_over():
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    text = cocos.text.Label('Game Over',
                            position=(w * 0.5, h * 0.5),
                            font_name=constants.OSWALD,
                            font_size=72,
                            anchor_x=constants.CENTER,
                            anchor_y=constants.CENTER)
    layer.add(text)
    scene = cocos.scene.Scene(layer)
    new_scene = FadeTransition(mainmenu.new_menu())
    replace_scene = lambda: director.replace(new_scene)
    scene.do(ac.Delay(3) + ac.CallFunc(replace_scene))
    return scene
def game_over():
    # create a text label
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    text = cocos.text.Label('Game Over',
                            position=(w * 0.5, h * 0.5),
                            font_name='Oswald',
                            font_size=72,
                            anchor_x='center',
                            anchor_y='center')
    layer.add(text)
    scene = cocos.scene.Scene(layer)

    menu_scene = FadeTransition(mainmenu.new_menu())
    show_menu = lambda: director.replace(menu_scene)
    scene.do(ac.Delay(3) + ac.CallFunc(show_menu))
    return scene
Exemple #6
0
def game_over(over=True):
    #print("game_over")
    w, h = director.get_window_size()
    layer = cocos.layer.Layer()
    if over:
        label_txt = "Game Over"
    else:
        label_txt = "Game Pass"
    text = cocos.text.Label(label_txt,
                            position=(w * 0.5, h * 0.5),
                            font_name='Oswald',
                            font_size=72,
                            anchor_x='center',
                            anchor_y='center')
    layer.add(text)
    scene = cocos.scene.Scene(layer)
    new_scene = FadeTransition(mainmenu.new_menu())
    func = lambda: director.replace(new_scene)
    scene.do(ac.Delay(3) + ac.CallFunc(func))
    return scene
Exemple #7
0
from cocos.director import director

import pyglet.font
import pyglet.resource

from mainmenu import new_menu


if __name__ == "__main__":
    pyglet.resource.path.append("assets")
    pyglet.resource.reindex()
    pyglet.font.add_file("assets/Oswald-Regular.ttf")

    director.init(caption="Tower Defense")
    director.run(new_menu())
from cocos.director import director

import pyglet.font
import pyglet.resource

from mainmenu import new_menu

if __name__ == '__main__':
    pyglet.resource.path.append('assets')
    pyglet.resource.reindex()
    pyglet.font.add_file('assets/Oswald-Regular.ttf')

    director.init(caption='Tower Defense')
    director.run(new_menu())