Exemplo n.º 1
0
def enter():
    global Ally, Enemy, CursorImage, Cursor_M1, Cursor_M2, Cursor_W, BackGroundImage, Font, UI, Cost, Score, OverSound, BGM, ClearSound, PauseUI,\
        ClearImage, stage, KillCount, Cursor_Ig, Font2, AllclearSound, IsClear, ClearTimer
    BGM = pico2d.load_music('Sound\\main.ogg')
    ClearSound = pico2d.load_wav('Sound\\clear.wav')
    AllclearSound = pico2d.load_wav('Sound\\allclear.wav')
    BGM.repeat_play()
    OverSound = pico2d.load_wav('Sound\\gameover.wav')
    Cost = 50
    stage = 1
    KillCount = 0
    IsClear = False
    ClearTimer = 0
    Enemy = []
    Ally = [
        Object.Ally(0, WindowWidth / 2, WindowHeight / 2),
        Object.Ally(1, WindowWidth / 2 + 50, WindowHeight / 2 + 50),
        Object.Ally(1, WindowWidth / 2 + 50, WindowHeight / 2 - 50),
        Object.Ally(1, WindowWidth / 2 - 50, WindowHeight / 2 + 50),
        Object.Ally(1, WindowWidth / 2 - 50, WindowHeight / 2 - 50)
    ]  # 오브젝트 초기 할당
    CursorImage = load_image('image\\Cursor.png')
    Cursor_M1 = load_image('image\\Monster1.png')
    Cursor_M2 = load_image('image\\Monster2.png')
    Cursor_W = load_image('image\\Fake_cursor.png')
    Cursor_Ig = load_image('image\\ignite.png')
    BackGroundImage = load_image('image\\back.png')
    Font = load_font('MapleBold.ttf', 30)
    Font2 = load_font('MapleBold.ttf', 10)
    PauseUI = load_image('image\\UI\\PauseButton.png')
    ClearImage = load_image('image\\UI\\clear.png')

    pass
Exemplo n.º 2
0
def handle_events():
    global Cursor_x, Cursor_y
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
        elif event.type == SDL_MOUSEMOTION:  # 마우스 움직일 때
            Cursor_x, Cursor_y = event.x, main_state.WindowHeight - 1 - event.y
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and main_state.O_Type == 1:
            if main_state.Cost >= 10:
                main_state.Cost -= 10
                main_state.Ally.append(
                    Object.Ally(main_state.O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and main_state.O_Type == 2:
            if main_state.Cost >= 20:
                main_state.Cost -= 20
                main_state.Ally.append(
                    Object.Ally(main_state.O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and main_state.O_Type == 3:
            if main_state.Cost >= 10:
                main_state.Cost -= 10
                main_state.Ally.append(
                    Object.Ally(main_state.O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:  # esc key 커서 복귀
            main_state.O_Type = 0
        elif event.type == SDL_KEYDOWN and event.key == SDLK_1:
            main_state.O_Type = 1
        elif event.type == SDL_KEYDOWN and event.key == SDLK_2:
            main_state.O_Type = 2
        elif event.type == SDL_KEYDOWN and event.key == SDLK_3:
            main_state.O_Type = 3
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_RETURN):
            game_framework.pop_state()

    pass
Exemplo n.º 3
0
def handle_events():
    global Cursor_x, Cursor_y
    global O_Type
    global Cost
    global KillCount
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:  # 창 닫기
            game_framework.quit()
        elif event.type == SDL_MOUSEMOTION:  # 마우스 움직일 때
            Cursor_x, Cursor_y = event.x, WindowHeight - 1 - event.y
        elif event.type == SDL_MOUSEBUTTONDOWN:
            if WindowWidth - 75 <= Cursor_x <= WindowWidth - 25:
                if WindowHeight - 75 <= Cursor_y <= WindowHeight - 25:
                    game_framework.push_state(pause_state)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and O_Type == 1:
            if IsClear is False:
                if Cost >= 20:
                    Cost -= 20
                    Ally.append(Object.Ally(O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and O_Type == 2:
            if IsClear is False:
                if Cost >= 30:
                    Cost -= 30
                    Ally.append(Object.Ally(O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and O_Type == 3:
            if IsClear is False:
                if Cost >= 20:
                    Cost -= 20
                    Ally.append(Object.Ally(O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE and O_Type == 4:
            if IsClear is False:
                if Cost >= 30:
                    Cost -= 30
                    Ally.append(Object.Ally(O_Type, Cursor_x, Cursor_y))
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:  # esc key 커서 복귀
            O_Type = 0
        elif event.type == SDL_KEYDOWN and event.key == SDLK_1:
            O_Type = 1
        elif event.type == SDL_KEYDOWN and event.key == SDLK_2:
            O_Type = 2
        elif event.type == SDL_KEYDOWN and event.key == SDLK_3:
            O_Type = 3
        elif event.type == SDL_KEYDOWN and event.key == SDLK_4:
            O_Type = 4
        elif event.type == SDL_KEYDOWN and event.key == SDLK_k:
            KillCount += 10
        elif event.type == SDL_KEYDOWN and event.key == SDLK_l:
            Cost += 50