def update():
    global zombie_list
    for game_object in game_world.all_objects():
        game_object.update()
    for Zom in zombie_list:
        if collide(boy, Zom):
            print("Boom")
            import pickle
            text = None
            read_data = []
            with open('rank.pickle', 'rb') as f:
                read_data = pickle.load(f)
            data = (str)(get_time() - boy.start_time)
            read_data.append(data)
            with open('rank.pickle', 'wb') as f:
                pickle.dump(read_data, f)
            game_framework.change_state(rank_state)
            break
def update():
    global character1, character2, Sjelly, Bjelly
    global level1_total_time, checkk, aim_up, aim_down

    for game_object in game_world.all_objects():
        game_object.update()

    for Sjelly in small_jelly:
        if Sjelly.x < 190:
            for l in life_location:
                life_location.remove(l)
                game_world.remove_object(l)
                checkk = 1
                if len(life_location) == 0:
                    game_framework.change_state(failure_state)
                Sjelly.disappear()
                break

        if character_select_state.character_select_number == 1:
            if collide(character1, Sjelly):
                Sjelly.disappear()
        elif character_select_state.character_select_number == 2:
            if collide(character2, Sjelly):
                Sjelly.disappear()

    for Bjelly in big_jelly:
        if Bjelly.x < 190:
            for l in life_location:
                life_location.remove(l)
                game_world.remove_object(l)
                checkk = 1
                if len(life_location) == 0:
                    game_framework.change_state(failure_state)
                Bjelly.disappear()
                break
        if character_select_state.character_select_number == 1:
            if collide(character1, Bjelly):
                Bjelly.disappear()
        elif character_select_state.character_select_number == 2:
            if collide(character2, Bjelly):
                Bjelly.disappear()

    if boss_character.hp <= 0:
        game_framework.change_state(success_state_Lv1)
Exemple #3
0
    def do(monster1):
        if monster1.move == 1 and monster1.x >= 128 * 6 - 64:
            monster1.move = 2
        elif monster1.move == 2 and monster1.y <= 720 - (128 * 10 - 64):
            monster1.move = 3
        elif monster1.move == 3 and monster1.x >= 128 * 18 - 64:
            monster1.move = 4
        elif monster1.move == 4 and monster1.y >= 720 - (128 * 7 - 64):
            monster1.move = 5
        elif monster1.move == 5 and monster1.x <= 128 * 12 - 64:
            monster1.move = 6

        if monster1.move == 1:
            monster1.x += 1.5
        elif monster1.move == 2:
            monster1.y -= 1.5
        elif monster1.move == 3:
            monster1.x += 1.5
        elif monster1.move == 4:
            monster1.y += 1.5
        elif monster1.move == 5:
            monster1.x -= 1.5
        elif monster1.move == 6:
            monster1.y += 1.5

        for game_object in game_world.all_objects():
            if str(game_object).find("shot_arrow") != -1:  # shot_arrow와 충돌시
                if game_object.x > monster1.x - 64 and game_object.x < monster1.x + 64 and game_object.y < monster1.y + 64 and game_object.y > monster1.y - 64:
                    game_world.remove_object(game_object)
                    monster1.hp -= 40
                    break
            elif str(game_object).find("elf_arrow") != -1:  # elf_arrow와 충돌시
                if game_object.x > monster1.x - 64 and game_object.x < monster1.x + 64 and game_object.y < monster1.y + 64 and game_object.y > monster1.y - 64:
                    game_world.remove_object(game_object)
                    monster1.hp -= 40
                    break

        if monster1.hp <= 0:  #피가 0되서 죽음
            game_world.remove_object(monster1)
            main_state.ui.money += 10

        if monster1.y > 720 + 64:  #경로에 나가서 사라짐
            game_world.remove_object(monster1)
            main_state.ui.life -= 1
Exemple #4
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()
    # 마리오와 적이 충돌하면 하트 1개 없어짐
    if collide(mario, enemy):
        game_world.remove_object(mario_life)

    # 마리오가 점프로 적을 죽이면 적 없어짐
    if collide(mario, enemy) and mario.is_jump:
        game_world.remove_object(enemy)

    # 마리오 & 아이템박스 충돌체크
    # 충돌하면 아이템이 나옴
    global item
    if collide(mario, item_box):
        print("collide")
        item_box.collide_to_mario = True
        item = Item()
        game_world.add_object(item, 0)
Exemple #5
0
def draw():
    clear_canvas()
    for game_objects in game_world.all_objects():
        game_objects.draw()
    if main_state.warrior.gameWon == 0:
        image.clip_draw_to_origin(30, 0, 34, 32, 0, 150, 300, 300)
        skull.clip_draw_to_origin(96, 15, 60, 15, 90, 330, 150, 37)
        font.draw(80, 405, 'YOU ARE DEAD!', (0, 0, 0))
        font.draw(80, 310, 'Level : %3d' % main_state.warrior.lvl, (0, 0, 0))
        font.draw(80, 290, 'SCORE : %3d' % main_state.warrior.score, (0, 0, 0))
        font.draw(75, 250, '    ESC TO TITLE', (0, 0, 0))
    else:
        vessel.clip_draw_to_origin(0, 0, 88, 128, 0, 0, 320, 576)
        image.clip_draw_to_origin(30, 0, 34, 32, 0, 150, 300, 300)
        font.draw(80, 405, 'YOU GOT THE BOSS!', (0, 0, 0))
        font.draw(80, 310, 'Level : %3d' % main_state.warrior.lvl, (0, 0, 0))
        font.draw(80, 290, 'SCORE : %3d' % main_state.warrior.score, (0, 0, 0))
        font.draw(75, 250, '    ESC TO TITLE', (0, 0, 0))
    update_canvas()
def update():
    global game_speed, camera_moving_degree_x, map_stop, finish_timer, stop
    if stop % 2 == 0:
        game_speed += RUN_SPEED_PPS
        # speed 만큼 카메라가 이동하였다.
        camera_moving_degree_x += game_speed * game_framework.frame_time
        if camera_moving_degree_x >= WORD_END_X - 980:
            map_stop = True
        InputGame_SpeedORCamera_Moveing_Degree()
        # 시간이 지날수록 속도 빨라지게
        for game_object in game_world.all_objects():
            game_object.update()
    if character.is_death:
        fail_state.cur_stage = 1
        background.bgm.stop()
        finish_timer -= game_framework.frame_time
        stop = 1
        if finish_timer < 0:
            game_framework.change_state(fail_state)
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    for ball in balls:
        if collide(boy, ball):
            boy.boy_hp += 100
            balls.remove(ball)
            game_world.remove_object(ball)
    for ball in balls:
        if collide(zombie, ball):
            zombie.zombie_hp += 100
            balls.remove(ball)
            game_world.remove_object(ball)
    if collide(boy, zombie):
        if boy.boy_hp >= zombie.zombie_hp:
            game_world.remove_object(zombie)
        else:
            game_world.remove_object(boy)
Exemple #8
0
    def update(self):  # 스플라인 곡선 그리기
        self.x = (1 - self.time / 100) * (
            1 - self.time / 100) * self.sx + 2 * (1 - self.time / 100) * (
                self.time / 100) * (self.sx + self.dx - 1800) + (
                    self.time / 100) * (self.time / 100) * self.dx
        self.y = (1 - self.time / 100) * (
            1 - self.time / 100) * self.sy + 2 * (1 - self.time / 100) * (
                self.time / 100) * (self.sy + self.dy - 500) + (
                    self.time / 100) * (self.time / 100) * self.dy
        self.time += 1
        self.frame = 1 + (self.frame +
                          player.FRAMES_PER_ACTION * player.ACTION_PER_TIME *
                          game_framework.frame_time) % 3

        if self.x > 1400 - 25:
            for Enmey_Bullet in game_world.all_objects():
                if Enmey_Bullet.state == 5:
                    game_world.remove_object(Enmey_Bullet)
            game_world.remove_object(self)
Exemple #9
0
    def update(self):
        if self.upgrade >= 1:
            self.damage = 10
        if self.upgrade == 2:
            self.delays = 0.7

        for game_object in game_world.all_objects():  #맨앞 몬스터 위치
            if str(game_object).find("monster1") != -1 or str(
                    game_object).find("monster2") != -1 or str(
                        game_object).find("monster3") != -1 or str(
                            game_object).find("monster4") != -1 or str(
                                game_object).find("boss") != -1 or str(
                                    game_object).find("teemo") != -1:
                if math.sqrt((game_object.x - self.x)**2 +
                             (game_object.y - self.y)**2) < 250:
                    if get_time() >= self.time + 1.5:  # 마법 사용
                        magic = Magic(self.x, self.y, self.damage, self.delays)
                        game_world.add_object(magic, 2)
                        self.time = get_time()
def update():
    global game_speed, camera_x, map_stop, stop, timer
    if stop % 2 == 0:
        game_speed += RUN_SPEED_PPS
        # speed 만큼 카메라가 이동하였다.
        camera_x -= game_speed * game_framework.frame_time
        if camera_x <= 3:
            map_stop = True
        InputGame_SpeedORCamera_Moveing_Degree()
        # 시간이 지날수록 속도 빨라지게
        for game_object in game_world.all_objects():
            game_object.update()
    if character.is_death:
        timer -= game_framework.frame_time
        fail_state.cur_stage = 3
        background.bgm.stop()
        stop = 1
        if timer < 0:
            game_framework.change_state(fail_state)
Exemple #11
0
def update():
    boy.setFlag(True)

    for ball in balls:
        if collide(grass, ball):
            ball.stop()
        if collide(brick, ball):
            ball.stop()
            ball.setX(brick.getMoveForce())
    if collide(boy, brick):
        boy.stop()
        boy.setX(brick.getMoveForce())
        boy.setFlag(False)
    if collide(boy, grass):
        boy.stop()
        boy.setFlag(False)

    for game_object in game_world.all_objects():
        game_object.update()
Exemple #12
0
def update():
    global TreeCount, BushCount, BoxCount
    for game_object in game_world.all_objects():
        game_object.update()
    for enemy in enemys:
        if player.hide == False:
            if collide(player, enemy):
                player.collide_enemy()
                print("Collision with Enemy")

    for tree in trees:
        if collide(player, tree):
            player.collide_obj()
            print("Collision with Tree")

    player.hide = False

    for bush in bushes:
        if collide(player, bush):
            player.hide = True
            print("player Collision with Bush")

    for box in boxes:
        if collide(player, box):
            player.collide_obj()
            print("Collision with Tree")
            box.collision = True
        else:
            box.collision = False

    for banana in bananas:
        if collide(player, banana):
            banana.Collide()
            bananas.remove(banana)
            game_world.remove_object(banana)
            player.hp += 5

    if collide(player, key):
        key.Collide()
        key.collision = True

    if player.hp < 0:
        game_framework.run(FailState)
Exemple #13
0
def update():
    global boss_bullet_count, boss_bullet, final_boss, test_dead_boss
    for game_object in game_world.all_objects():
        game_object.update()

    for bullet in bullet_list:
        if collide(bullet, final_boss):
            game_world.remove_object(bullet)
            bullet_list.remove(bullet)
            final_boss.hp -= 1
            print(final_boss.hp)
            if final_boss.hp < 0:
                game_world.remove_object(final_boss)
                test_dead_boss = Dead_effect(final_boss.x, final_boss.y)
                game_world.add_object(test_dead_boss, 1)
                test_dead_boss.explosion()
                main_state.stage1_score += 10000

    for bullet in skill_bullet_list:
        if collide(bullet, final_boss):
            game_world.remove_object(bullet)
            skill_bullet_list.remove(bullet)
            final_boss.hp -= 5
            print(final_boss.hp)
            if final_boss.hp < 0:
                game_world.remove_object(final_boss)
                test_dead_boss = Dead_effect(final_boss.x, final_boss.y)
                game_world.add_object(test_dead_boss, 1)
                test_dead_boss.explosion()
                main_state.stage1_score += 10000

    for bullet in boss_bullet:
        if collide(bullet, plane):
            game_world.remove_object(plane)
            death_plane_final_boss = Death_plane(plane.x, plane.y)
            game_world.add_object(death_plane_final_boss, 1)
            death_plane_final_boss.dead_plane = True
            death_plane_final_boss.explosion()
            game_framework.change_state(game_over_state)

    if final_boss.hp < 0:
        game_framework.change_state(all_stage_clear_state)
Exemple #14
0
def draw():
    global stage1_map, ingame_word, screen_timer, screen_timer_2, bazzi, gameover_timer

    hide_cursor()
    clear_canvas()
    screen_timer += game_framework.frame_time
    stage1_map.draw(WIDTH // 2, HEIGHT // 2)

    for game_object in game_world.all_objects():
        game_object.draw()

    if screen_timer < 2:
        if enemy_count == 0:
            ingame_word.clip_draw(0, 300, 405, 72, WIDTH // 2 - 50,
                                  HEIGHT // 2)
    if screen_timer_2 > 2:
        if enemy_count == 4:
            game_framework.change_state(stage2_state)
            Bazzi.bubble_limit = 1
            bazzi.bubble_count = 0
            game_world.remove_object(bazzi)
            for n in range(len(block)):
                game_world.remove_object(block[n])
            for n in range(len(enemy)):
                game_world.remove_object(enemy[n])
    if enemy_count == 4:
        ingame_word.clip_draw(0, 125, 405, 62, WIDTH // 2 - 50, HEIGHT // 2)
        screen_timer_2 += game_framework.frame_time
    if bazzi.go_main == 1:
        ingame_word.clip_draw(0, 0, 405, 62, WIDTH // 2 - 50, HEIGHT // 2)
        gameover_timer += game_framework.frame_time
        if gameover_timer > 3:
            game_framework.change_state(menu_state)
            Bazzi.bubble_limit = 1
            bazzi.bubble_count = 0
            bazzi.go_main = 0
            game_world.remove_object(bazzi)
            for n in range(len(block)):
                game_world.remove_object(block[n])
            for n in range(len(enemy)):
                game_world.remove_object(enemy[n])
    update_canvas()
Exemple #15
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    # 마리오가 점프로 적을 죽이면 적 없어짐
    if collide(mario, enemy):
        if mario.y >= enemy.y + 30:
            #print("c1")
            game_world.remove_object(enemy)

        else:
            #print("c2")
            game_world.remove_object(mario_life)

    # 마리오 & 아이템박스
    global item
    if collide(mario, item_box):
        item_box.collide_to_mario = True
        mario.is_collide_item_box = True
        # 충돌하면 아이템이 나옴
        item = Item()
        game_world.add_object(item, 0)

    # 마리오 & 벽돌
    if collide(mario, brick):
        mario.is_collide_brick = True

    # 마리오 & 벽돌 아래
    if collide_down(brick, mario):
        mario.is_jump = False

    # 마리오 & 땅
    if collide(mario, map):
        mario.y = 130

    # 마리오 & 아이템
    if collide(mario, item):
        print("flfsdfsdffdsfdsfds")
        game_world.remove_object(item)
        print("flfsdfsdffdsfdsfds")
        mario.is_transform = True
        mario.attack_enemy = True
Exemple #16
0
def update():
    global pass_score_state

    for game_object in game_world.all_objects():
        game_object.update()

    center_x, center_y = int(stickman.xpos // 40), int(stickman.ypos // 40)
    center_x_left, center_x_right = clamp(0, center_x - 1,
                                          max_horizontal_num - 1), clamp(
                                              0, center_x + 1,
                                              max_horizontal_num - 1)
    center_y_bottom, center_y_top = clamp(0, center_y - 2,
                                          max_vertical_num - 1), clamp(
                                              0, center_y + 1,
                                              max_vertical_num - 1)

    collide_check = False  #stickman.crash_tile 검사용
    for i in range(center_x_left, center_x_right + 1, 1):
        for j in range(center_y_bottom, center_y_top + 1, 1):
            if (collide(stickman, tile[j][i])):
                if (tile[j][i].type != 0):
                    stickman.crash_tile(tile[j][i].type, j, i)
                    collide_check = True
                    pass_score_state = DIE
    if not collide_check:  #stickman.crash_tile이 안불렸다면
        stickman.crash = False  #stickman.crash 초기화

    if (stickman.opacify >= 1):
        if (limit_time - (get_time() - stage_past_time - pause_time) <= 0):
            if (now_stage_num + 1 - 2 * stage_run.now_stage_num < 0):
                stickman.external_add_event("DIE")
                pass_score_state = OVER_LIMIT_TIME
            else:
                pass_score_state = CLEAR
                game_framework.change_state(score_state)

        elif (stickman.xpos <= window_left + (stickman.size // 2)):
            load_stage()
            stickman.xpos = window_right - (stickman.size // 2)
    else:
        if (stickman.opacify == 0):
            game_framework.change_state(score_state)
Exemple #17
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    for ball in balls:
        if collide(boy, ball):
            balls.remove(ball)
            boy.hp += 100
            game_world.remove_object(ball)

        if collide(zombie, ball):
            balls.remove(ball)
            zombie.hp += 100
            game_world.remove_object(ball)

        if collide(boy, zombie):
            if boy.hp > zombie.hp:
                game_world.remove_object(zombie)
            else:
                game_framework.quit()
Exemple #18
0
def handle_events():
    global cursor
    global selected_character
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
            return
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE):
            game_world.clear()
            game_framework.change_state(title_state)
        elif (event.type, event.button) == (SDL_MOUSEBUTTONDOWN,
                                            SDL_BUTTON_LEFT):
            if selected_character != 'none':
                game_world.clear()
                game_framework.push_state(main_state)
        else:
            for game_object in game_world.all_objects():
                game_object.handle_event(event)
            return
Exemple #19
0
def update():
    global background

    for game_object in game_world.all_objects():
        game_object.update()

    for ball in balls:
        if background.window_left > 0 and \
                background.window_left < background.w - background.canvas_width:
            ball.x -= boy.x_velocity * game_framework.frame_time

        if background.window_bottom > 0 and \
                background.window_bottom < background.h - background.canvas_height:
            ball.y -= boy.y_velocity * game_framework.frame_time

        if collide(boy, ball):
            boy.check += 1
            balls.remove(ball)
            boy.eat(ball)
            game_world.remove_object(ball)
Exemple #20
0
def update():
    global destination
    colliding = False

    if initium_state.city_dialogue_played:
        for dl in dungeon_location:
            if collide(dl, location_bar):
                location_bar.set_colliding(True)
                colliding = True
                destination = dl.get_type()
                break

        if not colliding:
            location_bar.set_colliding(False)
            destination = -1
    else:
        initium_state.city_dialogue.update()

    for game_object in game_world.all_objects():
        game_object.update()
Exemple #21
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    if collide_left(enemy, mario):
        game_world.remove_object(mario_life)

    if collide_up(enemy, mario):
        game_world.remove_object(enemy)

    if collide_right(enemy, mario):
        game_world.remove_object(mario_life2)

    # 마리오 & 아이템박스
    global item
    if collide(mario, item_box):
        item_box.collide_to_mario = True
        mario.is_collide_item_box = True
        # 충돌하면 아이템이 나옴
        item = Item()
        game_world.add_object(item, 0)

    # 마리오 & 벽돌
    if collide(mario, brick):
        mario.is_collide_brick = True

    # 마리오 & 벽돌 아래
    if collide_down(brick, mario):
        mario.is_jump = False

    # 마리오 & 땅
    if collide(mario, map):
        mario.y = 130

    # 마리오 & 아이템
    if collide(mario, item):
        print("flfsdfsdffdsfdsfds")
        game_world.remove_object(item)
        print("flfsdfsdffdsfdsfds")
        mario.is_transform = True
        mario.attack_enemy = True
Exemple #22
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    if (len(ball) != 0):
        if collide(zombie, ball[0]):
            if (len(ball) > 5):
                zombie.hp += 100
            else:
                zombie.hp += 50
            game_world.remove_object(ball[0])
            ball.remove(ball[0])

    if collide(zombie, boy):
        if zombie.hp > boy.hp:
            boy.hp -= 100
        else:
            zombie.hp -= 100

    if boy.hp <= 0 or zombie.hp < 0:
        game_framework.quit()
Exemple #23
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    for ball in balls:
        if collide(boy, ball):
            balls.remove(ball)
            game_world.remove_object(ball)

    for ball in balls:
        if collide(grass, ball):
            ball.stop()

    for ball in balls:
        if collide(brick, ball):
            ball.brick_move(brick.dir, brick.move_speed)

    if collide(brick, boy):
        boy.brick_move(brick.dir, brick.move_speed)
    else:
        boy.fall_check = True
Exemple #24
0
def update():
    global big_balls,balls, boy, zombie;

    for game_object in game_world.all_objects():
        game_object.update()

    #for ball in balls:
    #    if boy:
    #        if collide(boy, ball):
    #            boy.increase_hp(ball.hp);
    #            balls.remove(ball);
    #            game_world.remove_object(ball);

    #for big_ball in big_balls:
    #    if boy:
    #        if collide(boy, big_ball):
    #            boy.increase_hp(big_ball.hp);
    #            big_balls.remove(big_ball);
    #            game_world.remove_object(big_ball);
    
    for ball in balls:
        if zombie:
            if collide(zombie, ball):
                zombie.increase_hp(ball.hp);
                balls.remove(ball);
                game_world.remove_object(ball);

    for big_ball in big_balls:
        if zombie:
            if collide(zombie, big_ball):
                zombie.increase_hp(big_ball.hp);
                big_balls.remove(big_ball);
                game_world.remove_object(big_ball);

    if zombie and boy:
        if collide(boy, zombie):
            if 0 <len( balls )or  0 <len( big_balls): #공을 다먹었으면 보이가 죽고 아니면 좁비가 죽음.
                game_world.remove_object(zombie);
            else:
                game_world.remove_object(boy);
Exemple #25
0
def update():
    global index
    for game_object in game_world.all_objects():
        game_object.update()
    if collide(PuyoStage, puyo[main_state.index]):
        #for pu in puyo:
            # collide(puyo[main_state.index],pu(not puyo[main_state.index])) or collide(puyo[main_state.index+1],pu(not puyo[main_state.index+1])):
                #puyo[main_state.index].gravity = 0
                #puyo[main_state.index+1].gravity = 0
        index +=2
        game_world.add_object(puyo[main_state.index],2)
        puyo[main_state.index + 1].y += 35 * 1.8
        game_world.add_object(puyo[main_state.index+1],2)

    for puyo in puyos:
        if main_state.index >= 1 and collide(puyo, puyos[main_state.index]):
            if main_state.index < 47:
                main_state.index += 1
            else:
                game_framework.quit()
            print(main_state.index)
          return game_framework.push_state(main_state)
def update():
    for game_object in game_world.all_objects():
        game_object.update()

    if collide(boy, zombie):
        if boy.hp > zombie.hp:
            game_world.remove_object(zombie)
            print("좀비는 죽음")
        elif boy.hp < zombie.hp:
            print("게임오버")

    for ball in balls:
        if collide(boy, ball):
            balls.remove(ball)
            game_world.remove_object(ball)
            print("보이 볼 충돌")
            boy.hp += 100
        if collide(zombie, ball):
            balls.remove(ball)
            game_world.remove_object(ball)
            print("좀비 볼 충돌")
            zombie.hp += 100
Exemple #27
0
def update():
    for game_object in game_world.all_objects():
        game_object.update()
    for ball in balls:
        if collide(boy, ball):
            balls.remove(ball)
            game_world.remove_object(ball)
    for ball in balls:
        if collide(grass, ball):
            ball.stop()
        if collide(brick, ball):
            if brick.y + 20 < ball.y - 19:
                ball.stop()
            ball.x += brick.direction * brick.speed * game_framework.frame_time
            ball.x = clamp(25, ball.x, 1600 - 25)
    if collide(boy, brick):
        if brick.y + 20 < boy.y - 15:
            boy.fall_speed = 0
        boy.x += brick.direction * brick.speed * game_framework.frame_time
        boy.x = clamp(25, boy.x, 1600 - 25)
    else:
        boy.fall_speed = 800
def update():
    global game_speed, camera_moving_degree_x, map_stop, stop, timer
    if stop % 2 == 0:
        game_speed += RUN_SPEED_PPS * 0.1
        # speed 만큼 카메라가 이동하였다.
        camera_moving_degree_x += game_speed * game_framework.frame_time
        if camera_moving_degree_x >= WORD_END_X - 980:
            map_stop = True
        if VIHICLE_START_POINT <= character.x < character_class.GET_OFF_POS:
            character.ride_ufo = True
            ufo.move = True
        InputGame_SpeedORCamera_Moveing_Degree()
        # 시간이 지날수록 속도 빨라지게
        for game_object in game_world.all_objects():
            game_object.update()
    if character.is_death or ufo.collide:
        timer -= game_framework.frame_time
        fail_state.cur_stage = 2
        background.bgm.stop()
        stop = 1
        if timer < 0:
            game_framework.change_state(fail_state)
Exemple #29
0
def update():
    global next_stage_time, protecting_time, start_protecting
    for game_object in game_world.all_objects():
        game_object.update()

    # 처음 시작할때 잠시 무적
    start_protecting += 0.01
    if start_protecting <= 2.0:
        rect.isCollide = True

    # boss_face & rect 충돌
    if collide(rect, boss_face) and not rect.isCollide:
        rect.isCollide = True
        rect.hp -= 1
        print("rect & boss_face COLLISION")

    # smallest_enemies & rect 충돌
    for smallest in smallest_enemies:
        if collide(smallest, rect) and not rect.isCollide:
            rect.isCollide = True
            rect.hp -= 1
            print("rect & smallest enemy COLLISION")

    # small_enemies & rect 충돌
    for small in small_enemies:
        if collide(small, rect) and not rect.isCollide:
            rect.isCollide = True
            rect.hp -= 1
            print("rect & small enemy COLLISION")

    # stage2로 넘어감
    next_stage_time += 0.01
    if next_stage_time > 90.0:
        game_framework.change_state(stage2_image)

    # rect.hp == 0이 되면 game over
    if rect.hp <= 0:
        game_framework.change_state(gameover_image)
    pass
Exemple #30
0
    def update(self):
        self.cur_state.do(self)
        if len(self.event_que) > 0:
            event = self.event_que.pop()
            self.cur_state.exit(self, event)
            self.cur_state = next_state_table[self.cur_state][event]
            self.cur_state.enter(self, event)
        for game_object in game_world.all_objects():
            if str(game_object).find("zombie") != -1:  # shot_arrow와 충돌시
                if game_object.x > self.x - 64 and game_object.x < self.x + 64 and game_object.y < self.y + 64 and game_object.y > self.y - 64:
                    game_framework.ranking_score[10] = get_time(
                    ) - self.start_time
                    for j in range(0, 10):
                        for i in range(0, 10):
                            if game_framework.ranking_score[
                                    i] < game_framework.ranking_score[i + 1]:
                                a = game_framework.ranking_score[i]
                                game_framework.ranking_score[
                                    i] = game_framework.ranking_score[i + 1]
                                game_framework.ranking_score[i + 1] = a

                    game_framework.change_state(ranking_state)