def handle_events(frame_time): global arrow global YESstate, NOstate events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() else: if (event.type, event.key) == (SDL_KEYDOWN, SDLK_LEFT): arrow -= 1 if arrow < YESstate: arrow = NOstate pass elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_RIGHT): arrow += 1 if arrow > NOstate: arrow = YESstate pass elif (event.type, event.key) == (SDL_KEYDOWN,13): if (arrow == YESstate): game_framework.push_state(clear_state) pass elif (arrow == NOstate): game_framework.pop_state() pass pass change_font_color()
def handle_events(frame_time): global running global arrow events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() else: if (event.type, event.key) == (SDL_KEYDOWN, SDLK_UP): arrow -= 1 if arrow < GAME_START: arrow = GAME_QUIT pass elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_DOWN): arrow += 1 if arrow > GAME_QUIT: arrow = GAME_START pass elif (event.type, event.key) == (SDL_KEYDOWN, 13): if (arrow == GAME_START): game_framework.change_state(main_state) pass elif (arrow == GAME_HOW): game_framework.push_state(howto_state) pass elif (arrow == GAME_QUIT): running = False pass pass change_font_color()
def handle_events(frame_time): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE: game_framework.push_state(pause_state) else: game.handle_events(event) pass pass
def ask_game_clear(self): game_framework.push_state(askpause_state)