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.change_state(title_state) pass pass
def update(frame_time): global logo_time if (logo_time > 1.0): logo_time = 0 # game_framework.quit() game_framework.change_state(title_state) #push_state 하면 pause가 실행 (갔다 올 때) #change_state 하면 exit가 실행 (내용 저장할 필요 없을 때) logo_time += 0.5
def update(self, frame_time): if self.minutes == 0 and self.seconds == 0: #print("화면이동") game_framework.change_state(over_state) if self.minutes == 0 and self.seconds <= 10: self.color = [255, 0, 0] self.elapsedTime = time.time() - self.startTime if (self.seconds < 0): self.minutes -= 1 self.seconds = 59 elif int(self.elapsedTime) - self.count == 0: self.count += 1 self.seconds -= 1