示例#1
0
def end_game():
    global state
    if state != IN_GAME:
        return
    state = GAME_OVER
    highscore.add(score.score)
    gfw.world.add(gfw.world.layer.highscore, highscore)
示例#2
0
def end_game():
    global state
    print('Dead')
    state = STATE_GAME_OVER
    music_bg.stop()

    highscore.add(score)
    gfw.world.add(gfw.layer.ui, highscore)
示例#3
0
def end_game():
    global state
    if state != IN_GAME:
        return
    state = GAME_OVER
    print("Game Over")
    board.slow_down_animation()
    highscore.add(score.score)
    gfw.world.add(gfw.layer.highscore, highscore)
示例#4
0
def enter():
    global title_font, score_font
    gfw.world.init(['bg', 'button'])
    center = get_canvas_width() // 2, get_canvas_height() // 2
    gfw.world.add(gfw.layer.bg, gobj.ImageObject('결과배경.png', center))
    pos = get_canvas_width() // 2, 150
    gfw.world.add(gfw.layer.button, gobj.ImageObject('결과화면 버튼.png', pos))
    score_font = gfw.font.load(gobj.res('NanumGothic.TTF'), 100)
    title_font = gfw.font.load(gobj.res('NanumGothic.TTF'), TITLE_FONT_SIZE)
    highscore.load(TITLE_FONT_SIZE)
    highscore.add(Tile.SCORE)
示例#5
0
    def update(self):
        self.map.update()
        for name in self.mActorName:
            for actor in self.mActors[name]:
                actor.update()

        if len(self.mDeadActors) > 0:
            self.clearDeadActor()

        if self.mEndGame:
            self.mGame.popPage()
            highscore.add(self.map.mStage, self.mUI.score)
            self.mGame.pushPage(rankpage.RankPage(self.mGame))
示例#6
0
def build_world():
    gfw.world.init(['ui', 'ui2'])
    global image
    image = load_image('res/ranking.png')

    font = gfw.font.load(gobj.res('CookieRun.TTF'), 30)

    l, b, w, h = 750, 50, 200, 80
    btn = Button(l, b, w, h, font, "로비", lambda: gfw.change(lobby_state))
    gfw.world.add(gfw.layer.ui, btn)

    highscore.load()
    highscore.add(game_state.score)
    gfw.world.add(gfw.layer.ui2, highscore)
示例#7
0
文件: pair_state.py 项目: nemchang/2d
def update():

    global lose_image, win_image, TIME, Ehp
    count = 0
    center = (320, 640)
    Ehp = enemy.life

    global aa, skilefx, skilefy, ene

    if Ehp <= 0:
        gfw.world.add(gfw.layer.state,
                      gobj.ImageObject(theme + '/win.png', (320, 800)))
        gfw.world.add(gfw.layer.ui, highscore)

        return

    gfw.world.update()

    if skil.active == True or pattern.active == True:
        aa += gfw.delta_time

        skilx = Skileffect(1, (skilefx, skilefy), theme)
        gfw.world.add(gfw.layer.card, skilx)
        gfw.world.remove(skilx)

        if aa >= 1.2:
            aa = 0
            skilefx = 500
            skil.active = 0
            pattern.active = 0
            pattern.skil = 0

        skilefx = skilefx - aa * 7
    else:
        skilefx = 500
        aa = 0

    if gfw.world.count_at(gfw.layer.card) > 0:
        if TIME <= 1:
            return

        else:
            TIME -= gfw.delta_time * 30

        # print(gfw.world.count_at(gfw.layer.card), score, gfw.delta_time, gfw.frame_interval)
    if enemy.dead == 1:
        highscore.add(TIME)
示例#8
0
def enter():
    print("RankingState Enter")
    global ButtonSound, BackSound
    BackSound = load_music('res/RankMusic.mp3')
    ButtonSound = load_wav('res/ButtonSound.wav')

    global ranking_back, target, target_pos, back, gotomain, quit_game

    if main_state.CheckGame: highscore.add(game_state.score)

    back = gfw.load_image('res/background.png')
    ranking_back = gfw.load_image('res/rk.png')
    target = load_image('res/target.png')
    target_pos = 0, 0
    gotomain = load_image('res/gotomain.png')
    quit_game = load_image('res/quit.png')
    BackSound.repeat_play()
示例#9
0
def enter():
    global bg, gameover, win, board, font
    bg = gfw.image.load('res/result_bg.png')
    gameover = gfw.image.load('res/game_over.png')
    board = gfw.image.load('res/board.png')
    win = gfw.image.load('res/win.png')

    highscore.load()
    highscore.add(stage.score)

    global music_gameover, music_win
    music_gameover = load_wav('sound/gameover.wav')
    music_gameover.set_volume(30)
    music_win = load_wav('sound/win.wav')
    music_win.set_volume(30)

    if IsWin:
        music_win.repeat_play()
    else:
        music_gameover.repeat_play()
示例#10
0
def handle_event(e):
    global player, name, clear_time
    global cheat_key, cheat_name

    # prev_dx = boy.dx

    if e.type == SDL_QUIT:
        gfw.quit()
    elif e.type == SDL_KEYDOWN:
        if boss.get_boss_die() != 0:
            if e.key != None:
                if 32 <= int(e.key) and e.key <= int(126):
                    if len(name) < 13:
                        name += chr(e.key)
                elif e.key == SDLK_BACKSPACE:
                    name = name[:-1]
                elif e.key == SDLK_RETURN:
                    highscore.load()
                    highscore.add(clear_time, name)
                    highscore.save()
                    gfw.change(start_state)
                    clear_time = 0
        elif e.key == SDLK_ESCAPE:
            gfw.push(pause_state)
        elif e.key == SDLK_r:
            if player.die_value == 1:
                gfw.change(start_state)
        elif e.key == SDLK_1:
            cheat_key = True
        elif cheat_key == True:
            if e.key != None:
                if 32 <= int(e.key) and e.key <= int(126):
                    cheat_name += chr(e.key)
                elif e.key == SDLK_RETURN:
                    check_cheat()

    elif e.type == SDL_KEYUP:
        if e.key == SDLK_1:
            cheat_key = False
    player.handle_event(e)
示例#11
0
def end_game():
    global game_state
    game_state = STATE_GAME_OVER
    music_bg.stop()
    highscore.add(player.score)
    gfw.world.add(gfw.layer.ui, highscore)
def endgame():
    global state
    state = END_GAME
    music_bg.stop()
    gfw.change(Gameover_state)
    highscore.add(score.score + dis_score.score)
示例#13
0
def menuStart(theme):
    highscore.add(str(horz_state.score))
    menu_state.theme = theme
    gfw.push(menu_state)