def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_SPACE): boy.fire()
def handle_event(e): global player if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop()
def handle_event(e): global running if e.type == SDL_QUIT: gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() cookie.handle_event(e)
def handle_event(e): global player, set_tile # prev_dx = boy.dx if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_SPACE: f = open(FILE_NAME, "wb") pickle.dump(data_tile, f) f.close() elif e.key == SDLK_a: set_tile += 1 if set_tile > 3: set_tile = 0 if e.key == SDLK_ESCAPE: gfw.pop() player.handle_event(e) if e.type == SDL_MOUSEBUTTONDOWN: mouse_pos = bg.translate((e.x, get_canvas_height() - 1 - e.y)) player_xindex = (int)(mouse_pos[0] // 68) player_yindex = (int)(mouse_pos[1] // 82) if e.button == SDL_BUTTON_LEFT: data_tile[player_yindex][player_xindex].tile = set_tile data_tile[player_yindex][player_xindex].pos = (player_xindex, player_yindex) data_tile[player_yindex][player_xindex].col = True elif e.button == SDL_BUTTON_RIGHT: data_tile[player_yindex][player_xindex].tile = 0 data_tile[player_yindex][player_xindex].pos = (0, 0) data_tile[player_yindex][player_xindex].col = False
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() if e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() player.handle_event(e)
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_SPACE): gfw.push(game_state)
def handle_event(e): global strokeInput, downInput, inputType, key_ctrl, key_s, isEnd if e.type == SDL_QUIT: return gfw.quit() if e.type == SDL_KEYDOWN: if e.key != None and e.key >= ord('a') and e.key <= ord( 'z') and key_ctrl == False: print(str(chr(e.key - 32)) + str(time.time())) strokeInput.addInput(chr(e.key - 32), time.time()) downInput.addInput(chr(e.key - 32), time.time()) if e.key == SDLK_LCTRL: key_ctrl = True if e.key == SDLK_s: key_s = True if e.key == SDLK_ESCAPE: return gfw.pop() if e.key == SDLK_RETURN and isEnd == True: return gfw.pop() if e.type == SDL_KEYUP: if e.key == SDLK_LCTRL: key_ctrl = False if e.key == SDLK_s: key_s = False pass
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.change(title_state) elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_p): gfw.pop()
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() return elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() return elif e.key == SDLK_p: global paused paused = not paused elif e.key == SDLK_RETURN: if not paused: return global prito_cooldown prito_cooldown = random.uniform(5, 10) paused = False bgm.repeat_play() elif e.key == SDLK_s: gfw.change(score_state) score_state.set_attempt(player.n_die) elif e.key == SDLK_d: global disabled disabled = not disabled player.handle_event(e) if not prito.handle_event(e): player.die()
def handle_event(e): global player global TileSetMode global isPaused global pauseMenu if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: pause_state() if not isPaused: player.handle_event(e) else: if e.type == SDL_KEYDOWN: if e.key == SDLK_DOWN and pauseMenu < 2: pauseMenu += 1 elif e.key == SDLK_UP and pauseMenu > 0: pauseMenu -= 1 elif e.key == SDLK_RETURN: if pauseMenu == 0: isPaused = False elif pauseMenu == 1: save_pickle() elif pauseMenu == 2: gfw.pop()
def handle_event(e): global unit # prev_dx = boy.dx if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop()
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() if handle_mouse(e): return
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() if e.key == SDLK_RETURN or e.key == SDLK_KP_ENTER: gfw.change(main_state)
def handle_event(e): if e.type == SDL_QUIT: return gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: return gfw.pop() elif e.key == SDLK_RETURN: return gfw.pop()
def handle_event(e): event = (e.type, e.key) if e.type == SDL_QUIT: gfw.quit() elif event == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() player.handle_event(e)
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_p: gfw.push(pause_state) boy.handle_event(e)
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_RETURN: start_game() player.handle_event(e)
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() if e.type == SDL_MOUSEBUTTONDOWN: print(e.x, " ", e.y) if handle_mouse(e): return
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() global ntime if int(ntime) > 2.5 and e.type == SDL_KEYDOWN: for i in range(5): gfw.world.clear_at(i) gfw.pop() else: pass
def handle_event(e): # prev_dx = boy.dx if e.type == SDL_QUIT: gfw.quit() return elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() return if player.handle_event(e): return
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_RETURN: #엔터 게임시작 start_game() elif e.key == SDLK_SPACE: #스페이스바 다음스테이지 gfw.push(howtostage2) player.handle_event(e)
def handle_event(e): global player # prev_dx = boy.dx if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_SPACE or e.key == SDLK_UP: jump.play() player.handle_event(e)
def handle_event(e): global simon if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_RETURN: start_game() print('restart') simon.handle_event(e)
def update(self): global time, frame, frame_, speed, check, correct, p_key, key, practice,\ last_speak, goal, progress, count1, count2, intro, whistle_num, time_, m_intro, speed_check time += gfw.delta_time frame_ = round(time * speed, 1) frame = int(time * speed) % 10 frame = 1800 - frame * 200 if frame == 1800 and round(frame_ - int(frame_), 2) == 0.9 and progress != 0 and not intro: self.Correct_Check() # 너무 늦게 클릭 확인 if frame == 600 and round(frame_ - int(frame_), 2) == 0.1 and progress != 0: if speed_check == False: speed_check = True self.Speed_Up() # 속도 증가 -> 1번에 0.025씩 if frame == 1600 and round(frame_ - int(frame_), 2) == 0.9: #참고 - 프레임이 1600일때는 키보드 입력 안됨 #초기화 check = False correct = True p_key = 0 key = -1 speed_check = False # 종료 -> 초기화 if progress == goal + 1 and round(frame_ - int(frame_), 2) == 0.9: if last_speak == True and intro == False and practice == False: #마지막 구호 말했을때 goal += 5 #처음부터 +5만큼 다시하기 count1 = 0 count2 = 0 progress = 0 time = 0 speed = 4 whistle_num = 5 last_speak = False elif intro == False and practice == True: #연습끝 practice = False progress = 0 goal = 15 count1 = 0 count2 = 0 time = 0 speed = 4 whistle_num = 5 time_ = get_time() m_intro = True else: #스테이지1 클리어 print("Stage1 Clear!\nhealth: ", self.health) gfw.pop(self.health)
def handle_event(e): global knight, frame if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_a: if knight.mask > 0: knight.mask = 5 frame.refill_all() knight.handle_event(e)
def handle_event(e): global bgm if e.type == SDL_QUIT: gfw.quit() else: if (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE): bgm.stop() gfw.quit() elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_r): bgm.stop() gfw.pop()
def handle_event(e): event = (e.type, e.key) if e.type == SDL_QUIT: gfw.quit() elif event == (SDL_KEYDOWN, SDLK_ESCAPE): gfw.pop() elif event == (SDL_KEYDOWN, SDLK_RETURN): if game_over or game_clear: exit() enter() player.handle_event(e)
def handle_event(evt): if evt.type == SDL_QUIT: gfw.quit() return elif evt.type == SDL_KEYDOWN: if evt.key == SDLK_ESCAPE: gfw.pop() return elif evt.key == SDLK_p: global paused paused = not paused if player.handle_event(evt): return
def handle_event(e): if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() elif e.key == SDLK_RETURN: #엔터 게임시작 #music_bg.stop() start_game() elif e.key == SDLK_SPACE: #스페이스바 다음스테이지 global CHECK CHECK = False player2.handle_event(e)
def handle_event(e): global player # prev_dx = boy.dx if e.type == SDL_QUIT: gfw.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: gfw.pop() player.handle_event(e) if e.type == SDL_KEYDOWN and e.key == SDLK_s: gfw.world.save(SAVE_FILENAME) print('Saved to:', SAVE_FILENAME)