Exemplo n.º 1
0
Arquivo: Main.py Projeto: HeeYong2/DF
def handle_events():
    global gunner , Move
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            FrameWork.quit()
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:
            FrameWork.change_state(Title)
        else:
            gunner.handle_event(event)
Exemplo n.º 2
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            FrameWork.quit()
        else:
            if (event.type , event.key) == (SDL_KEYDOWN , SDLK_ESCAPE):
                FrameWork.quit()
            elif (event.type , event.key) == (SDL_KEYDOWN , SDLK_SPACE):
                FrameWork.change_state(Main)
    pass
Exemplo n.º 3
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            FrameWork.quit()
        else:
            if (event.type , event.key) == (SDL_KEYDOWN , SDLK_ESCAPE):
                FrameWork.quit()
            elif (event.type , event.key) == (SDL_KEYDOWN , SDLK_SPACE):
                FrameWork.change_state(Main)
    pass
Exemplo n.º 4
0
def handle_events():
    global gunner
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            FrameWork.quit()
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:
            FrameWork.change_state(Title)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_RIGHT:
            if gunner.state != gunner.RIGHT_WALK:
                gunner.direction = gunner.PLAYER_RIGHT
                gunner.state = gunner.RIGHT_WALK
                gunner.endframe = 10
                gunner.startframe = 3
        elif event.type == SDL_KEYDOWN and event.key == SDLK_UP:
            if gunner.state != gunner.RIGHT_WALK:
                gunner.direction = gunner.PLAYER_UP
                gunner.state = gunner.RIGHT_WALK
                gunner.endframe = 10
                gunner.startframe = 3

        elif event.type == SDL_KEYUP and event.key == SDLK_RIGHT:
            if gunner.state != gunner.RIGHT_STAND1:
                gunner.state = gunner.RIGHT_STAND1
                gunner.endframe = 11
                gunner.startframe = 0

        elif event.type == SDL_KEYUP and event.key == SDLK_UP:
            if gunner.state != gunner.RIGHT_STAND1:
                gunner.state = gunner.RIGHT_STAND1
                gunner.endframe = 11
                gunner.startframe = 0
            """
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE:
            if gunner.state == gunner.LEFT_RUN:
                gunner.state = gunner.RIGHT_RUN
            elif gunner.state == gunner.RIGHT_RUN:
                gunner.state = gunner.LEFT_RUN
            elif gunner.state == gunner.RIGHT_STAND:
                gunner.state = gunner.RIGHT_RUN
            elif gunner.state == gunner.LEFT_STAND:
                gunner.state = gunner.LEFT_RUN
                """
    pass
Exemplo n.º 5
0
def handle_events():
    global gunner
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            FrameWork.quit()
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:
            FrameWork.change_state(Title)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_RIGHT:
            if gunner.state != gunner.RIGHT_WALK:
                gunner.direction = gunner.PLAYER_RIGHT
                gunner.state = gunner.RIGHT_WALK
                gunner.endframe = 10
                gunner.startframe = 3
        elif event.type == SDL_KEYDOWN and event.key == SDLK_UP:
            if gunner.state != gunner.RIGHT_WALK:
                gunner.direction = gunner.PLAYER_UP
                gunner.state = gunner.RIGHT_WALK
                gunner.endframe = 10
                gunner.startframe = 3

        elif event.type == SDL_KEYUP and event.key == SDLK_RIGHT:
            if gunner.state != gunner.RIGHT_STAND1:
                gunner.state = gunner.RIGHT_STAND1
                gunner.endframe = 11
                gunner.startframe = 0

        elif event.type == SDL_KEYUP and event.key == SDLK_UP:
            if gunner.state != gunner.RIGHT_STAND1:
                gunner.state = gunner.RIGHT_STAND1
                gunner.endframe = 11
                gunner.startframe = 0
            """
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE:
            if gunner.state == gunner.LEFT_RUN:
                gunner.state = gunner.RIGHT_RUN
            elif gunner.state == gunner.RIGHT_RUN:
                gunner.state = gunner.LEFT_RUN
            elif gunner.state == gunner.RIGHT_STAND:
                gunner.state = gunner.RIGHT_RUN
            elif gunner.state == gunner.LEFT_STAND:
                gunner.state = gunner.LEFT_RUN
                """
    pass