def update(): global logo_time if logo_time > 1.5: logo_time = 0 framework.change_state(state_Title) logo_time += framework.frame_time
def update(frame_time): global mainmenu mainmenu.update(frame_time) menum = mainmenu.depthlist[mainmenu.currdepth] if io.key_check_pressed(ord('z')): io.clear() elif io.key_check_pressed(SDLK_RETURN) or io.key_check_pressed(ord('x')): io.clear() audio_play("sndMenuSelect") if mn_begin == menum.menusel: framework.change_state(game) elif mn_opt == menum.menusel: io.clear() framework.push_state(main_option) elif mn_credit == menum.menusel: io.clear() elif mn_end == menum.menusel: framework.quit() elif io.key_check_pressed(SDLK_UP): if menum.menusel <= 0: menum.menusel = menum.menucnt - 1 else: menum.menusel -= 1 elif io.key_check_pressed(SDLK_DOWN): if menum.menusel >= menum.menucnt - 1: menum.menusel = 0 else: menum.menusel += 1
def handle_events(): events = pico2d.get_events() for event in events: if event.type == SDL_QUIT: framework.running = False if (event.type, event.key) == (SDL_KEYDOWN, SDLK_RETURN): press_sound.play() framework.change_state(state_StageBuild)
def hit_starship(): starship.explode() ui.add_event((LIFE, -1)) ui.update() if ui.get_starship_life() == 0: framework.change_state(state_StageEnd) else: framework.push_state(state_StageRegen)
def update(frame_time): global logo_time, targ_time, alpha_max, alpha if logo_time <= 0: logo_time = 0 alpha -= frame_time else: logo_time -= frame_time if alpha <= -alpha_max: framework.change_state(main)
def update(): global timer timer -= framework.frame_time for gameobj in gameworld.all_objects(): gameobj.update() if timer < 0: framework.change_state(state_Ranking)
def stage_complete(): stage_clear() audio_stream_stop() global stagelist if len(stagelist) > 0: framework.push_state(game_complete) else: framework.change_state(game_clear_all)
def handle_events(frame_time): global tpush bevents = get_events() for event in bevents: if event.type == SDL_QUIT or (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): framework.quit() elif tpush > 1.2: if (event.type, event.key) == (SDL_KEYDOWN, ord('x')): framework.change_state(game) killcount_clear()
def update(): global timer timer -= framework.frame_time for gameobj in gameworld.all_objects(): gameobj.update() if timer < 0: if ui.get_stage_num() == 5: framework.change_state(state_StageEnd) return framework.change_state(state_StageEnter)
def update(): for gameobj in gameworld.all_objects(): gameobj.update() line.update() for bullet in starship_bullets: for enemy in enemies: if intersect_bb(bullet, enemy): if enemy.is_attack_state(): ui.add_event((SCORE, 250)) else: ui.add_event((SCORE, 200)) enemy.hit() starship_bullets.remove(bullet) gameworld.remove_object(bullet) break for bullet in enemy_bullets: if intersect_bb(starship, bullet): enemy_bullets.remove(bullet) gameworld.remove_object(bullet) hit_starship() break for enemy in enemies: if intersect_bb(starship, enemy): enemy.hit() hit_starship() break # 총알이 클라이언트 밖에 나갔나 검사 for bullet in starship_bullets: if bullet.out_client(): starship_bullets.remove(bullet) gameworld.remove_object(bullet) break for bullet in enemy_bullets: if bullet.out_client(): enemy_bullets.remove(bullet) gameworld.remove_object(bullet) break if len(enemies) == 0: framework.change_state(state_StageClear)
def die(self): io.clear() audio_play("sndDie") framework.change_state(game_over)