def update(frame_time): global logo_time if logo_time > 5.0: logo_time = 0 game_framework.push_state(title_state) logo_time += frame_time
def handle_events(): global start_but global help_but global exit_but global main_pointer events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type in (SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONDOWN, SDL_MOUSEMOTION): main_pointer.update(event.x, 700 - event.y) start_but.mousemove_on(event.x, 700 - event.y) help_but.mousemove_on(event.x, 700 - event.y) exit_but.mousemove_on(event.x, 700 - event.y) if event.button == SDL_BUTTON_LEFT: if start_but.get_mouse_on(): global_parameters.global_snd.play_snd('button') game_framework.change_state(level_state) break if help_but.get_mouse_on(): global_parameters.global_snd.play_snd('button') game_framework.push_state(help_state) break if exit_but.get_mouse_on(): global_parameters.global_snd.play_snd('button') game_framework.quit() break
def handle_events(frame_time): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_MOUSEMOTION: if menu.cursor_start(event): menu.big_start() elif menu.cursor_tutorial(event): menu.big_tutorial() elif menu.cursor_exit(event): menu.big_exit() else: menu.all_small() elif event.type == SDL_MOUSEBUTTONDOWN: if menu.cursor_start(event): game_framework.push_state(main_state) if menu.cursor_tutorial(event): game_framework.push_state(tutorial_state) if menu.cursor_exit(event): game_framework.quit() elif event.type == SDL_KEYDOWN: if event.key == SDLK_ESCAPE: game_framework.quit()
def update(): for game_object in game_world.all_objects(): game_object.update() for fiser in fish: if fiser.HP<=0: fish.remove(fiser) number[fiser.y//50][fiser.x//50]=0 game_world.remove_object(fiser) tiles.lock -=1 for birds in bird: if birds.HP<=0: bird.remove(birds) number[birds.y//50][birds.x//50]=0 game_world.remove_object(birds) tiles.lock -= 1 if number[int(hero.y // 50)][int(hero.x // 50)] is 5: game_framework.push_state(game_end_state) if hero.HP < 0 + 1: game_framework.push_state(game_over_state) if tiles.lock<=0: for i in range(0, 45): for j in range(0, 60): if number[i][j] is 6: number[i][j]=5 open_lock.play(1)
def handle_events(): global TreeCount, BushCount, BananaCount, player, background, hp events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif player.hp <= 0: game_framework.run(FailState) elif (event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE): game_framework.run(FailState) elif (event.type == SDL_KEYDOWN and event.key == SDLK_2): TreeCount = 0 BananaCount = 0 BushCount = 0 hp = player.hp game_framework.change_state(main_state_2) elif player.x > 1280 - 100: TreeCount = 0 BananaCount = 0 BushCount = 0 hp = player.hp game_framework.change_state(main_state_2) elif background.timer > 60.0: game_framework.run(FailState) elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(Pause_state) else: player.handle_event(event)
def handle_events(): global Level, frame_time, score, hp_gauge, skill 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(stop_state) elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_LEFT): if girl.way == 2: pass else: girl.way = 1 Level += 1 score += 60 if Level > 144: hp_gauge.frame -= 6 elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_RIGHT): if girl.way == 1: pass else: girl.way = 2 Level += 1 score += 60 if Level > 144: hp_gauge.frame -= 6 elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_x): skill.handle_skill()
def update(self): # frame about bombanimation global itemstar global blockteam global block global badendbgm self.frame = (self.frame + 1) % 4 self.time = (self.time + 1) % 14 for block in blockteam: if block.blx == self.x and block.bly == self.y: self.x, self.y = random.randrange(40, 570, 40), random.randrange(60, 500, 40) # 폭탄과 벽의 중복사라지게하는곳 if self.dieframe < 4 and self.count == 3: self.dieframe = self.dieframe + 1 elif self.dieframe == 4: game_framework.push_state(gameover) bgm.stop() badendbgm.set_volume(128) badendbgm.repeat_play() # not yet if self.time == 0: self.x, self.y = random.randrange(40, 610, 40), random.randrange(60, 500, 40) self.boomframe = 0
def update(self, timer): global blockteam global bombteam global aidiecount, aitime self.aiframe = (self.aiframe + 1) % 4 if timer % 3 == 0 and self.life > 0: self.ai_state_table[self.state](self) if self.aix < 40: self.aix += int(Ch.RUN_SPEED_PPS) if self.aix > 600: self.aix -= int(Ch.RUN_SPEED_PPS) if self.aiy > 552: self.aiy -= int(Ch.RUN_SPEED_PPS) if self.aiy < 55: self.aiy += int(Ch.RUN_SPEED_PPS) self.state = random.randrange(0, 4, 1) elif self.life <= 0: self.aidieframe = self.aidieframe + 1 if self.aidieframe == 4: aidiecount += 1 if aidiecount == keyinputcount: diesound = load_music("scream.mp3") diesound.set_volume(64) diesound.play(1) delay(1) game_framework.push_state(gameover) bgm.stop() badendbgm.set_volume(128) badendbgm.repeat_play() # not yet
def handle_events(): 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.quit() elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(pause_state) elif event.type == SDL_KEYDOWN and event.key == SDLK_c: boy.act_dash() elif event.type == SDL_KEYDOWN and event.key == SDLK_q: boy.drinkPotion() elif event.type == SDL_KEYDOWN and event.key == SDLK_a: boy.spellLight() else: boy.handle_event(event) if event.type == SDL_KEYDOWN and event.key == SDLK_s: boy.spellOnFire() elif event.type == SDL_KEYUP and event.key == SDLK_s: boy.spellOffFire() if event.type == SDL_KEYDOWN and event.key == SDLK_2: boy.openCure() elif event.type == SDL_KEYUP and event.key == SDLK_2: boy.closeCure()
def handle_events(): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_KEYDOWN and event.key == SDLK_p: # p키가 눌리면 game_framework.push_state(base_pause_state) # pause 화면으로 전환
def update(): global logo_time if (logo_time > 1.0): logo_time = 0 game_framework.push_state(title_state) delay(0.01) logo_time += 0.01
def update(): global logo_time if(logo_time >1.0): logo_time = 0 game_framework.push_state(map) delay(0.01) logo_time+=0.01
def update(frmae_time): global logo_time if logo_time > 1.0: logo_time = 0 game_framework.push_state(title_state) delay(0.01) logo_time += 0.01
def update(frame_time): global logo_time if logo_time > time_MAX: logo_time = 0 game_framework.push_state(game_state) delay(0.01) logo_time += 0.01
def handle_events(): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_KEYDOWN: if event.key == SDLK_ESCAPE: game_framework.change_state(mapstage_state) elif event.key == SDLK_RIGHT: bounce_ball.Ball.direction += RUN_SPEED_PPS ball.handle_event(bounce_ball.RIGHT_DOWN) elif event.key == SDLK_LEFT: bounce_ball.Ball.direction -= RUN_SPEED_PPS ball.handle_event(bounce_ball.LEFT_DOWN) elif event.key == SDLK_p: game_framework.push_state(pause_state) elif event.key == SDLK_r: load_map() elif event.type == SDL_KEYUP: if event.key == SDLK_RIGHT: bounce_ball.Ball.direction -= RUN_SPEED_PPS ball.handle_event(bounce_ball.RIGHT_UP) elif event.key == SDLK_LEFT: bounce_ball.Ball.direction += RUN_SPEED_PPS ball.handle_event(bounce_ball.LEFT_UP)
def onClick(context): global garage, player_info if context == 'racestart': game_framework.push_state(racing_state) if context == 'buy': have = player_info['coin'] cost = car_info[str(garage.slot[garage.select])]['cost'] if have >= cost: player_info['coin'] -= cost player_info['level'] += 1 player_info['have'].append(garage.slot[garage.select]) save_data() else: pass if context == 'before': game_framework.pop_state() if context == 'la': if garage.slot[0] > 0: garage.slot = [x - 1 for x in garage.slot] if context == 'ra': if garage.slot[2] < MAX_LEV - 1: garage.slot = [x + 1 for x in garage.slot] if context[0] == 's' and len(context) == 2: if context == 's1': garage.select = 0 if context == 's2': garage.select = 1 if context == 's3': garage.select = 2 if context == 'diff_up': garage.difficulty = pico2d.clamp(0, garage.difficulty + 1, 5) if context == 'diff_down': garage.difficulty = pico2d.clamp(0, garage.difficulty - 1, 5)
def draw(): global dice_num global chracter global tile global statbar global statpng global timer global map global bigfont global turntype global actionnumber clear_canvas() handle_events() backpicture.draw_to_origin(0,0) stat.draw() drawcard(actionnumber) if turntype==10 or turntype ==9: bigfont.draw(200,100,"PRESS SPACE!",color=(230,0,0)) if map.chracter.hp==0: game_framework.push_state(gameover) delay(0.01) update_canvas()
def update(frame_time): stage.update(frame_time) cat.update(frame_time) lands.update(frame_time) man.update(frame_time) enemy.update(frame_time) if collide(cat, stone): heart.attacked() if collide(cat, enemy): heart.attacked() if collide(cat, lands): print('collision') lands.stop(cat) if heart.state == heart.DIE: game_framework.push_state(gameover_state) #클리어 조건 if cat.x >= 5000: game_framework.push_state(stageclear_state) stage.clear() update_canvas()
def update(): if running == True: for block in blocks: block.y -= 5 block.bottom -= 5 block.top -= 5 if move == True: if reverse == True: BlueBall.angle -= 5 RedBall.angle -= 5 elif reverse == False: BlueBall.angle += 5 RedBall.angle += 5 BlueBall.x = 250 + (math.cos(BlueBall.angle * math.pi / 180.0) * 140) BlueBall.y = 150 + (math.sin(BlueBall.angle * math.pi / 180.0) * 140) RedBall.x = 250 + (math.cos(RedBall.angle * math.pi / 180.0) * 140) RedBall.y = 150 + (math.sin(RedBall.angle * math.pi / 180.0) * 140) BlueBall.update() RedBall.update() for block in blocks: if block.left < BlueBall.x < block.right and block.bottom < BlueBall.y < block.top: enter() elif block.left < RedBall.x < block.right and block.bottom < RedBall.y < block.top: enter() if blocks[len(blocks) - 1].y < -100: game_framework.push_state(stage2_state) delay(0.02) pass
def handle_events(frame_time): global main_pause events = get_events() stage.handle_event(events) wing.handle_event(events) boots.handle_event(events) fire_wall.handle_event(events) for fireBall in fireBalls: fireBall.handle_event(events) for jem in jems: jem.handle_event(events) for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_KEYDOWN: if event.key == SDLK_ESCAPE: game_framework.change_state(title_state) elif event.key == SDLK_h: game_framework.push_state(hold_state) elif event.key == SDLK_x and time_gauge.saved_percent > 0: # 타임 리프 시작 Change_time_back(True) else: sonic.handle_event(event) elif event.type == SDL_KEYUP: if event.key == SDLK_x: # 타임 리프 중지 Change_time_back(False)
def handle_events(frame_time): global name_x, select_menu, ishelp events=get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif(event.type == SDL_MOUSEMOTION): class_cursor.Cursor.x,class_cursor.Cursor.y=event.x,600-event.y elif event.type == SDL_MOUSEBUTTONDOWN and event.button ==SDL_BUTTON_LEFT: ishelp = False if select_menu == True: click_type = check_click(event.x,600-event.y) if click_type == NEW_GAME or click_type == LOAD_GAME: game_framework.push_state(main_state,click_type) if click_type == HELP: ishelp = True else: if(event.type) == (SDL_KEYDOWN): ishelp=False if(event.type, event.key) == (SDL_KEYDOWN,SDLK_ESCAPE): game_framework.quit() elif(event.type, event.key) == (SDL_KEYDOWN,SDLK_SPACE): if name_x != 365: name_x =365 else: select_menu = True
def handle_events(): events = get_events() global mouse_pressed, mouse_distance 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) elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(pause_state) elif event.type == SDL_KEYDOWN and event.key == SDLK_q: game_framework.push_state(menu_state) elif event.type == SDL_MOUSEBUTTONDOWN: mouse_pressed = True elif event.type == SDL_MOUSEBUTTONUP: mouse_pressed = False elif event.type == SDL_MOUSEMOTION: mouse.x = event.x mouse.y = 600 - event.y + 1 else: GoblinWarMachine_GWM.handle_event(event)
def handle_events(frame_time): global mario 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(title_state) elif event.type == SDL_KEYDOWN: if event.key == SDLK_UP : if mario.y == 90 : mario.state = 'JUMP' mario.jump_sound.play() if mario.y != 90 : mario.state = 'JUMP2' mario.jump_sound.play() elif event.key == SDLK_DOWN: if mario.state == 'RUN' : mario.state = 'SLIDE' elif event.type == SDL_KEYUP: if event.key == SDLK_DOWN: if mario.state == 'SLIDE' : mario.state = 'RUN'
def update(self):#frame about bombanimation #global bomb global itemuse global blockteam global block self.frame=(self.frame+1)%4 self.time+=1 self.boomceframe=(self.boomceframe+1)%3 self.boomframe=(self.boomframe+1)%8 for block in blockteam: if(block.blx == self.x and block.bly==self.y): self.x, self.y=random.randrange(40,570,40),random.randrange(60,500,40)#폭탄과 벽의 중복사라지게하는곳 if(self.dieframe<4 and self.count==3): self.dieframe=(self.dieframe+1) elif(self.dieframe==4): game_framework.push_state(gameover) if(self.aidieframe<4 and self.count==5): self.aidieframe=(self.aidieframe+1) elif(self.aidieframe==4): game_framework.push_state(gameover) if(self.time==11): self.x, self.y=random.randrange(40,610,40),random.randrange(60,500,40) self.time=0
def handle_events(): global see_right, skeletons, items, click, bonfire_ready, background, bonfire, light, stone, wood events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_MOUSEMOTION: mousecursor.position(x=event.x, y=VIEW_HEIGHT - 1 - event.y) elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE: del (skeletons) del (items) del light game_framework.change_state(title_state) elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(pause_state) elif event.type == SDL_MOUSEBUTTONDOWN and event.button == SDL_BUTTON_RIGHT: if collision(ui, mousecursor): if stone >= 2 and wood >= 2: game_world.remove_object(bonfire) game_world.remove_object(light) bonfire = Bonfire(player.x, player.y) game_world.add_object(bonfire, 3) bonfire.set_background(background) light = Light(bonfire.x, bonfire.y) game_world.add_object(light, 3) light.set_background(background) stone -= 2 wood -= 2 else: player.handle_event(event)
def update(): global x global running x+=1 delay(0.01) if(x>=100): game_framework.push_state(title_state)
def handle_events(): global IsShopOpened, button_on,click_sound global Shop events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_MOUSEBUTTONDOWN and event.button == SDL_BUTTON_LEFT: if button_on == SHOP_BUTTON: click_sound.play() if IsShopOpened: IsShopOpened = False else: IsShopOpened = True elif button_on == START_BUTTON: click_sound.play() game_framework.push_state(stage_state) bgm.stop() IsShopOpened = False elif event.type == SDL_MOUSEMOTION: mouse_x, mouse_y = event.x, 900 - event.y - 1 if math.sqrt((mouse_x - 70)**2 + (mouse_y - 70)**2) <= 100: button_on = SHOP_BUTTON elif math.sqrt((mouse_x - 1530)**2 + (mouse_y - 70)**2) <= 100: button_on = START_BUTTON else: button_on = None if IsShopOpened: Shop.handle_event(event)
def update(): global note_1_extreme, note_1s_extreme, note_2_extreme, note_2s_extreme, note_3_extreme, note_3s_extreme global note_4_extreme, note_4s_extreme, note_5_extreme, note_5s_extreme, note_6_extreme, note_6s_extreme, note_7_extreme, note_7s_extreme global machine_key_extreme, effect_1, effect_2, score_gauge, pdm, life_gauge, machine_1_extreme global playtime frametime.frame_time = frametime.get_frame_time() frametime.current_time += frametime.frame_time for note_1_extreme in note_1s_extreme: note_1_extreme.update() for note_2_extreme in note_2s_extreme: note_2_extreme.update() for note_3_extreme in note_3s_extreme: note_3_extreme.update() for note_4_extreme in note_4s_extreme: note_4_extreme.update() for note_5_extreme in note_5s_extreme: note_5_extreme.update() for note_6_extreme in note_6s_extreme: note_6_extreme.update() for note_7_extreme in note_7s_extreme: note_7_extreme.update() if (playtime > 330.0): playtime = 0 game_framework.push_state(result_state) delay(0.01) playtime += 0.05
def update(self): self.cx, self.cy = self.x - (self.bg.window_left * 32) - 16, self.y - ( self.bg.window_bottom * 32) self.tileX, self.tileY = (self.x - 16) // 32, (self.y - 16) // 32 if self.turn == 1: self.bt.run() # print("monster : ", (self.y - 16) // 32, (self.x - 16) // 32, map.MapLi[self.tileY][self.tileX]) if self.state == 0: self.timer = (self.timer + 1) % 1000 if self.timer > 800: self.idl = 1 else: self.idl = 0 if self.state == 1: self.deadTimer += 1 if self.deadTimer == 96: warrior = main_state.get_warrior() game_world.remove_object(self) warrior.gameWon = 1 warrior.score += 50 game_framework.push_state(game_over) if self.state == 2: self.atkTimer = (self.atkTimer + FRAMES_PER_ACTION * ACTION_PER_TIME * game_framework.frame_time) if self.atkTimer < 7: # 조정해. if self.atkTimer < 3: self.atkPose = 1 elif self.atkTimer < 5: self.atkPose = 2 else: self.atkPose = 3 else: self.atkTimer = 0 self.atkPose = 0 self.state = 0
def update(frame_time): global restartimage player.update(frame_time) if player.life > 0: finalboss.update(frame_time) for bullet in bullets: bullet.update(frame_time) for finalbullet in finalbullets: finalbullet.update(frame_time) if Boss_collide(player, finalbullet): player.die() if player.b_death == False: if Boss_collide(player, finalboss): player.die() if finalboss.s_die == False: for bullet in bullets: if Boss_collide(finalboss, bullet): finalboss.hurt() if bullets.count(bullet) > 0: bullets.remove(bullet) if finalboss.life <= 0: finalboss.death() if finalboss.life_flag == False: finalboss.remove(finalboss) if finalboss.life_flag != False: if int(get_time() % 8) == 0: final_shooting() if finalboss.life < 1: delay(0.1) game_framework.push_state(gameover) pass
def handle_events(): global life, ch, op events = get_events() for e in events: if e.type == SDL_QUIT: game_framework.quit() elif e.type == SDL_KEYDOWN: if e.key == SDLK_ESCAPE: game_framework.quit() elif e.key == SDLK_SPACE: game_framework.push_state(game) if e.key == SDLK_RIGHT: if life >= 3: life = 1 else: life += 1 if e.key == SDLK_LEFT: if life <= 1: life = 3 else: life -= 1 if e.key == SDLK_s: ch += 1 if ch > 15: ch = 0 op = 1 print("op on") else: op = 0
def handle_events(frame_time): global player_bullet global goto_next_stage global next_stage_score global score global timer events = get_events() # start var. if life is 0: gameover_state.get_score(score) game_framework.push_state(gameover_state) for event in events: if event.type == SDL_QUIT: save_score() game_framework.quit() else: if (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): save_score() game_framework.quit() elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE): if goto_next_stage is True: # next_stage_score = score # get_stage1_score(score) score += 1000 win_state.get_score(score) game_framework.change_state(win_state) else: player_bullet.handle_event(event) player.shooting_sound.play() # ranking state elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_c): timer.cancel() goto_next_stage = True else: player.handle_event(event)
def handle_events(): global time, go_shop, go_shop_click, bgm, sum_score global x, y events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_MOUSEMOTION: x, y = event.x, 800 - event.y elif event.type == SDL_MOUSEBUTTONDOWN: x, y = event.x, 800 - event.y if x > 485 and x < 735 and y > 195 and y < 255: go_shop.play() bgm.stop() game_framework.change_state(main_state) if x > 470 and x < 540 and y > 264 and y < 320: go_shop.play() game_framework.push_state(shop) else: if(event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): game_framework.quit() elif event.type == SDL_KEYDOWN and event.key == SDLK_2: sum_score += 100
def handle_events(): global arrive_planet,attack,select, x, y, start,attackplanet,selectplanet,check events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): game_framework.quit() elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_s): start = 1 elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE): game_framework.push_state(PlanetGame2) elif event.type == SDL_MOUSEBUTTONDOWN: if event.button == SDL_BUTTON_LEFT: x, y = event.x , 700-event.y for planet in allplanet: if planet.x - 50 < x < planet.x + 50 and planet.y - 50 < y < planet.y + 50: x = planet.x y = planet.y # if planet.planet_image == 1: if attack == False: attack=True print("Attak!") elif attack == True: attack = False else: if select == False: select == True print("select!") elif select == True: select == False selectplanet = planet planet.check = 1 select = True arrive_planet = planet.name
def handle_events(): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(pause_state_2)
def update(frame_time): global name global logo_time logo_time += frame_time if (logo_time > 4.0): logo_time = 0 game_framework.push_state(Title_Scene)
def handle_events(): global map, player, BushCount, TreeCount, BoxCount, KeyCount, boxes, hp, BananaCount 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.run(FailState) elif player.hp <= 0: game_framework.run(FailState) elif event.type == SDL_KEYDOWN and event.key == SDLK_3: TreeCount = 0 BananaCount = 0 BushCount = 0 hp = player.hp game_framework.change_state(main_state_3) elif map.timer > 60.0: game_framework.run(FailState) elif player.x > 1280 - 100 and key.collision == True: TreeCount = 0 BananaCount = 0 BushCount = 0 hp = player.hp game_framework.change_state(main_state_3) elif map.timer > 300.0: game_framework.run(FailState) elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE: for box in boxes: if box.collision == True: box.Attack_box() elif event.type == SDL_KEYDOWN and event.key == SDLK_p: game_framework.push_state(Pause_state) else: player.handle_event(event)
def update(): global note_S, note_Ss, note_D, note_Ds, note_F, note_Fs, note_SPACE, note_SPACEs, note_J, note_Js, note_K, note_Ks, note_L, note_Ls global machine_key, effect_1, effect_2, score_gauge, pdm, life_gauge, machine_1 global playtime frametime.frame_time = frametime.get_frame_time() frametime.current_time += frametime.frame_time for note_S in note_Ss: note_S.update() for note_D in note_Ds: note_D.update() for note_F in note_Fs: note_F.update() for note_SPACE in note_SPACEs: note_SPACE.update() for note_J in note_Js: note_J.update() for note_K in note_Ks: note_K.update() for note_L in note_Ls: note_L.update() if (playtime > 330.0): playtime = 0 game_framework.push_state(result_state) delay(0.01) playtime += 0.05
def choose_menu(): if menu_num == 1: game_framework.change_state(Cactus_Family) elif menu_num == 2: game_framework.push_state(score_state) elif menu_num == 3: game_framework.quit()
def update(frame_time): global logo_time if(logo_time > 1.0): logo_time = 0 game_framework.push_state(title_state) logo_time += 0.01
def update(frame_time): global logo_time if logo_time > 1.5: logo_time = 0 game_framework.push_state(title_state) logo_time += frame_time
def update(frame_time): global logo_time if (logo_time > 2.0): logo_time = 0 # game_framework.quit() game_framework.push_state(title_state) logo_time += frame_time
def update(): global logo_time if logo_time > 1.0: logo_time = 0 # game_framework.quit() game_framework.push_state(title_state) delay(0.01) logo_time += 0.01
def handle_events(frame_time): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): #if keydown 'p' return to previous state game_framework.push_state(title_state)
def update(frame_time): global title_time if(title_time > 0.1): title_time = 0 #game_framework.quit() game_framework.push_state(main_state) title_time += frame_time
def update(frame_time): global logo_time if(logo_time > 1.5): logo_time = 0 #game_framework.quit() game_framework.push_state(title_state) logo_time += frame_time
def update(frame_time): global intro_time if (intro_time > data['Public']['intro_time']): intro_time = 0 #game_framework.quit() game_framework.push_state(SelectCraft) intro_time += frame_time
def update(): global logo_time if(logo_time>1.0): logo_time=0 game_framework.push_state(game_title) #game_framework.quit() delay(0.01) logo_time+=0.01
def update(): global title_logo_time if(title_logo_time > 1.0 and game_framework.level != 0): title_logo_time = 0 game_framework.level +=1 print("레벨 업", game_framework.level) game_framework.push_state(main_state) delay(0.01) title_logo_time +=0.01
def update(): global logo_time,bgm if(logo_time > 1.0): logo_time = 0 # bgm.stop() game_framework.push_state(title_state) delay(0.01) logo_time +=0.01
def update(frame_time): global name global logo_time if (logo_time > 0.2): logo_time = 0 game_framework.push_state(title_state) #game_framework.quit() logo_time += frame_time
def update(): global logo_time if (logo_time > 2.0): logo_time = 0 # game_framework.quit() exit()함수를 호출한다. game_framework.push_state(title_state) #현재 상태를 유지하고 넘어간다. delay(0.01) logo_time += 0.01
def update(): global logo_time if (logo_time > 2.0): logo_time = 0 # game_framework.quit() game_framework.push_state(title_state) logo_time += 0.01 pass
def update(): global logo_time if(logo_time > 1.0): logo_time = 0 #game_framework.quit() game_framework.push_state(frist_stage) delay(0.01) logo_time += 0.01
def update(frame_time): # fill here global logo_time if logo_time > 0.1: logo_time = 0 # game_framework.quit() game_framework.push_state(title_state) logo_time += frame_time
def handle_events(frame_time): # fill here events = get_events() for event in events: if(event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): exit() elif(event.type, event.key) == (SDL_KEYDOWN, SDLK_q): game_framework.push_state(map_tool) else: boy.handle_events(event,frame_time )
def update(): global logo_time global bgm if (logo_time>1.0): logo_time=0 #game_framework.quit()#넌뭐니 game_framework.push_state(game_main) delay(0.01) logo_time +=0.01
def handle_events(frame_time): # fill here events = get_events() for event in events: if event.type == SDL_QUIT: exit() elif(event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE): exit() elif(event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE): #스페이스를 누를시 게임 화면으로 넘어감 game_framework.push_state(main_state)
def update(): global logo_time if( logo_time > 0.5 ): logo_time = 0 #game_framework.quit() game_framework.push_state(title_state) delay(0.01) logo_time = logo_time + 0.01
def handle_events(): events = get_events() for event in events: if event.type == SDL_QUIT: game_framework.quit() else: if(event.type ,event.key) == (SDL_KEYDOWN , SDLK_ESCAPE): game_framework.quit() elif(event.type , event.key) ==(SDL_KEYDOWN , SDLK_SPACE ): game_framework.push_state(main_state)