예제 #1
0
 def getHit(self):
     self.hp -= 100
     if self.hp > 0:
         self.State = STATE_ATTACKED
     else:
         print("die")
         game_framework.change_state(title_state)
예제 #2
0
파일: Main.py 프로젝트: xmfkdlrjs4/2dgp
def handle_events():
    global running
    global character
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            running = False
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:
            running = False
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE:
            game_framework.change_state(title_state)

        elif event.type == SDL_KEYDOWN and event.key == SDLK_LEFT:
            if(character.movey != 0):
                character.movey = 0
            character.status = 0
            character.movex = -3

        elif event.type == SDL_KEYDOWN and event.key == SDLK_RIGHT:
            if(character.movey != 0):
                character.movey = 0
            character.status = 1
            character.movex = 3

        elif event.type == SDL_KEYDOWN and event.key == SDLK_UP:
            if(character.movex != 0):
                character.movex = 0
            character.status = 2
            character.movey = 3
        elif event.type == SDL_KEYDOWN and event.key == SDLK_DOWN:
            if(character.movex != 0):
                character.movex = 0
            character.status = 3
            character.movey = -3
예제 #3
0
def handle_events():
    global isMouseClicked, isButtonClicked, MouseList, maincharacter, stargoal, is_goal, frame, main_state
    events = get_events()

    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
            is_goal = False
        elif event.type == SDL_MOUSEMOTION:
            if isMouseClicked:
                MouseList.append([event.x, 600 - event.y, random.randint(0, 3)])
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE):
            game_framework.change_state(title_state)
        elif (event.type, event.button) == (SDL_MOUSEBUTTONDOWN, SDL_BUTTON_LEFT):
            isMouseClicked = True
            mx = event.x
            my = 600 - event.y
            if (10 < mx < 90) and (515 < my < 585):
                startbutton.image = load_image("resource/start_button2.png")
                startbutton.draw()
                isButtonClicked = True
            if (710 < mx < 785) and (515 < my < 585):
                isButtonClicked = False
                MouseList = []
                enter()

        elif (event.type, event.button) == (SDL_MOUSEBUTTONUP, SDL_BUTTON_LEFT):
            isMouseClicked = False
예제 #4
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            del title_state.bgm
            del store_state.bgm
            game_framework.quit()
        else:
            if event.type == SDL_KEYDOWN:
                if event.key == SDLK_LEFT:
                    if store_state.sel_x > 380:
                        store_state.sel_x -= 150
                    pass
                elif event.key == SDLK_RIGHT:
                    if store_state.sel_x <= 380:
                        store_state.sel_x += 150
                    pass
                elif event.key == SDLK_SPACE:
                    if store_state.sel_x == 380:
                        del title_state.bgm
                        game_framework.change_state(title_state)
                        pass
                    elif store_state.sel_x == 530:
                        del store_state.bgm
                        game_framework.change_state(store_state)
                        pass
    pass
예제 #5
0
def handle_events(frame_time):
    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_UP):
                if floor.portal_flag == True:
                    temp.character_life = character.life
                    temp.character_skill = character.skill
                    game_framework.change_state(Semiboss_state)
                else:
                    pass
            else:
                character.handle_event(event)
                if character.b_attack == True:
                    shooting()
                if character.skill > 0 :
                    if character.b_skill == True:
                        if skillcol == False:
                            skilling()
                            character.skilldown()
                background.handle_event(event)
                floor.handle_event(event)
예제 #6
0
def update():
    redboy.update()
    for enemy in enemies:
        enemy.update()

    for member in snowball:
        member.update()

    for member in snowball:
        for enemy in enemies:
            if collide(member, enemy):
                enemies.remove(enemy)
                snowball.remove(member)
                enemy.death()


    for member in snowball2:
        member.update()

    for member in snowball2:
        if collide(member, redboy):
            redboy.remove(redboy)
            snowball2.remove(snow)

    if (len(enemies) == 0):
        game_framework.change_state(change_state)
def handle_events(frame_time):
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
        elif (event.type, event.button) == (SDL_MOUSEBUTTONDOWN, SDL_BUTTON_LEFT):
            global btn
            btn.click()

        elif event.type == SDL_MOUSEMOTION:
            x, y = event.x, event.y
            # 399-menubtn.w/2,599-menutitle.h-menubtn.h + 48*3
            print(x, y)
            if x > 399-menubtn.w/2 and x < 399-menubtn.w/2 + 160 and y > menutitle.h + 48*0 and y < menutitle.h + 48*0+48:
                MenuBtn.MOUSEON = 0
                print(MenuBtn.MOUSEON)
            elif x > 399-menubtn.w/2 and x < 399-menubtn.w/2 + 160 and y > menutitle.h + 48*1 and y < menutitle.h + 48*1+48:
                MenuBtn.MOUSEON = 1
                print(MenuBtn.MOUSEON)
            elif x > 399-menubtn.w/2 and x < 399-menubtn.w/2 + 160 and y > menutitle.h + 48*2 and y < menutitle.h + 48*2+48:
                MenuBtn.MOUSEON = 2
                print(MenuBtn.MOUSEON)
            elif x > 399-menubtn.w/2 and x < 399-menubtn.w/2 + 160 and y > menutitle.h + 48*3 and y < menutitle.h + 48*3+48:
                MenuBtn.MOUSEON = 3
                print(MenuBtn.MOUSEON)
            else:
                MenuBtn.MOUSEON = 4
        else:
            if(event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE):
                game_framework.quit()
            elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE):
                game_framework.change_state(worldmap)
예제 #8
0
파일: start_state.py 프로젝트: hbhdy/2DPro
def update(frame_time):
    global logo_time
    logo_time+=frame_time
    if(logo_time>1.0):
        logo_time=0
        #game_framework.quit()
        game_framework.change_state(title_state1)
예제 #9
0
def handle_events():
    global running
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            running = False
        elif event.type == SDL_KEYDOWN:
            whale.TempState = whale.state
            if event.key == SDLK_ESCAPE:
               running = False
               game_framework.change_state(title_state)
            if event.key == SDLK_UP:
                whale.state = Whale.UP
            if event.key == SDLK_DOWN:

                whale.state = Whale.DOWN
            if event.key == SDLK_RIGHT:

                whale.state = Whale.RIGHT
                whale.dir = True
            if event.key == SDLK_LEFT:

                whale.state = Whale.LEFT
                whale.dir = False
            if event.key == SDLK_SPACE:
                whale.level_up()
        elif event.type != SDL_KEYDOWN:
            whale.state = Whale.STOP
예제 #10
0
def update():
    global boy, grass1, airport, bg, bg2, dead
    boy.update()
    for grass in grass1:#바닥 업데이트
        grass.update()
    airport.update()
    bg.update()
    bg2.update()
    for grass in grass1:
        if boy.state == boy.running_state:
                if (collide(grass, boy) == False) and (grass.x<237) and (grass.x>103) :#걷다가 바닥이 없을때
                    boy.y -= 10#떨어진다
                    boy.goingdead = 1
                elif collide(grass, boy) and boy.y == 109:#걷는다 바닥이 있다 해당줄에
                    boy.goingdaed = 0
        if boy.state == boy.down_state:

            if collide(grass,boy) and boy.goingdaed == 1:
                boy.state = boy.running_state

    if collide(airport, boy):
        dead.state = dead.dead_state
        boy.state = boy.dead_state
    elif boy.y < 0:
        dead.state = dead.dead_state
    for grass in grass1:
        if grass.count_num > 50:
            game_framework.change_state(main_state2)
예제 #11
0
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)
예제 #12
0
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.change_state(title_state)
예제 #13
0
def handle_events():
    events = get_events()
    global x, y, PlayerName, ui, ui_button
    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 > 73 and x < 263 and y > 296 and y < 488:
                ui = UI("Sunny")
                UI.Type = 0
                UI.Init(None)
                print("Suny!!!!!!!!!!!!!!!!")
                ui_button.play(1)
                #game_framework.push_state(mainGame)
                game_framework.change_state(Shop)
            if x > 336 and x < 525 and y > 296 and y < 488:
                ui = UI("Raby")
                UI.Type = 1
                UI.Init(None)
                print("Raby!!!!!!!!!!!!!!")
                ui_button.play(1)
                #game_framework.push_state(mainGame)
                game_framework.change_state(Shop)
                #game_framework.change_state(main_raby)

        else:
            if (event.type, event.key) == (SDL_KEYDOWN, SDLK_ESCAPE):
                game_framework.quit()
예제 #14
0
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
예제 #15
0
def update():
    redboy.update()
    # enemy.update()
    for enemy in enemies:
        enemy.update()
    # snow.update()

    #    hpgauge.update()

    for member in snowball:
        member.update()

    for member in snowball:
        for enemy in enemies:
            if collide(member, enemy):
                enemies.remove(enemy)
                snowball.remove(member)

    for member in snowball2:
        if collide(member, redboy):
            redboy.remove(redboy)
            snowball2.remove(member)

    if len(enemies) == 0:
        game_framework.change_state(ending_state)
예제 #16
0
def handle_events():
    events = get_events()
    global x, y, PlayerName, ui, buy_weapon, shop_button
    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 > 40 and x < 190 and y > 350 and y < 530 :
                buy_weapon = ItemBuy('weapon', buy_weapon)
                shop_button.play(1)
            if x > 225 and x < 375 and y > 590 and y < 765 :
                UI.AddArmor(None)
                shop_button.play(1)
            if x > 400 and x < 556 and y > 350 and y < 530 :
                UI.AddBomb(None)
                shop_button.play(1)

        else:
            if (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE):
                game_framework.change_state(mainGame)
예제 #17
0
def update():
    redboy.update()
    #enemy.update()
    for enemy in enemies:
        enemy.update()
   # snow.update()

    #hpgauge.update()

    for member in snowball:
        member.update()

    for member in snowball:
        if collide(member, enemy):
            enemies.remove(enemy)

    for member in snowball2:
        member.update()

    for member in snowball2:
        if collide(member, redboy):
            redboy.remove(redboy)

    if (enemies == 0):
        game_framework.change_state(change_state)
예제 #18
0
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.change_state(title_state)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE:
            #LEFT_RUN, RIGHT_RUN, LEFT_STAND, RIGHT_STAND = 0, 1, 2, 3
            if boy.state == 0:
                boy.state = 1
            elif boy.state == 1:
                boy.state = 0
            elif boy.state == 2:
                boy.state = 0
                boy.run_frames = 0
                #boy.stand_frames = 0
            elif boy.state == 3:
                boy.state = 1
                boy.run_frames = 0
        elif event.type == SDL_KEYDOWN and event.key == SDLK_h:
            global test
            if test == 0:
                test = 1
            else:
                test = 0
def handle_events():
    global running      #함수가 작동 중인지 여부 확인.

    global Sliding      # 슬라이딩 중 다른 조작 못 하게.
    global Jumping      # 점프 중 다른 조작 못 하게.

    global braveCookie
    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(title_state)
            elif event.key == SDLK_UP :
                if braveCookie.Jumping == 0:
                    braveCookie.Jump()
                    braveCookie.PlusJumping()
                elif braveCookie.Jumping == 1:
                    braveCookie.ReDifine_Frame()
                    braveCookie.Jump_Double()
            elif event.key == SDLK_DOWN and braveCookie.Jumping == 0:
                braveCookie.Slide()
                Sliding += 1
        if event.type == SDL_KEYUP :    #키를 떼면!
            if Sliding != 0 :
                braveCookie.Running()
                Sliding = 0
예제 #20
0
def handle_events(frame_time):
    global collisionRectShow

    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)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_z:
            if player.get_player() == player_class.PLAYER_A :
                player_missile.showMissile(player.x, player.y)
            elif player.get_player() == player_class.PLAYER_S :
                player_protect_missile.showMissile(player.x, player.y)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_x:
            if player.get_player() == player_class.PLAYER_A :
                if player_special_missile_s.get_view() == False:
                    player_special_missile.showSpecial(player.x, player.y)
            elif player.get_player() == player_class.PLAYER_S :
                if player_special_missile.get_view() == False:
                    player_special_missile_s.showSpecial(player.x, player.y)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_r:
            if collisionRectShow == True:
                collisionRectShow = False
            else:
                collisionRectShow = True
        else:
            player.handle_event(event)
예제 #21
0
def handle_events():
    events = get_events()
    global select
    global selectsound, selectmovesound
    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):
                selectsound.play()
                delay(0.7)
                if select == 0:
                    game_framework.change_state(player1_main_state)
                elif select == 1:
                    game_framework.change_state(player2_main_state)
            if(event.type, event.key) == (SDL_KEYDOWN, SDLK_LEFT):
                if(select == 1):
                    select = 0
                    selectmovesound.play()
            elif(event.type, event.key) == (SDL_KEYDOWN, SDLK_RIGHT):
                if(select == 0) :
                    select = 1
                    selectmovesound.play()
예제 #22
0
def update(frame_time):
    global logo_time
    if (logo_time > 4.0): #3.9
        logo_time = 0
        game_framework.change_state(title_state)
    else:
        logo_time += frame_time
예제 #23
0
파일: game_title.py 프로젝트: rlatldms/2DGP
def update():
    global title_time
    if (title_time > 1.0):
        title_time = 0
        game_framework.change_state(game_main)
    delay(0.1)
    title_time += 0.1
예제 #24
0
파일: bad_end_state.py 프로젝트: thdbs/bine
def update(frameTime):
    global logo_time

    if(logo_time > 1.0):
        logo_time = 0.0
        game_framework.change_state(title_state)
    delay(0.01)
    logo_time += 0.01
예제 #25
0
def handle_events():
    events = get_events()
    for event in events:
        if (event.type == SDL_QUIT) or (event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE):
            game_framework.quit()

        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE):
            game_framework.change_state(main_state)
예제 #26
0
파일: rank.py 프로젝트: SongHyoungJong/2D
def handle_events(frame_time):
    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.change_state(title_state)
예제 #27
0
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)
        else:
            character.handle_event(event, bullet)
예제 #28
0
def update(frame_time):
    global regen_time, monster_count, death_time, holly_time, test
    frame_time += get_frame_time()

    character.update(frame_time)
    background.update(frame_time)
    floor.update(frame_time)

    regen_time += frame_time

    if monster_count != 0:
        if regen_time > Mushroom.REGEN_TIME:
            mushroom = Mushroom()
            monster_list.append(mushroom)
            regen_time = 0
            monster_count -= 1

    for mushroom in monster_list:
        mushroom.update(frame_time)
        if mushroom.attack_time == 5:
            if collision(character,mushroom) and character.state != character.DIE_STATE:
                character.now_hp -= mushroom.Mushroom_attack
                mushroom.attack_time -= 1
        if mushroom.attack_time != 5:
            mushroom.attack_time -= 1
            if mushroom.attack_time == 0:
                mushroom.attack_time = 5

        if character.state == character.SKILL_HOLLY_STATE:
            if collision_skill(character, mushroom):
                mushroom.hit(character.skill_holly_damage)

        if character.state == character.SKILL_LAST_STATE:
            if collision_skill_last(character, mushroom):
                mushroom.hit(character.skill_last_damage)

        if mushroom.Mushroom_nowhp <= 0:
            death_time += frame_time
            if monster_list.count(mushroom) > 0 and death_time > 0.5:
                monster_list.remove(mushroom)
                death_time = 0
                character.now_exp += mushroom.mushroom_exp


    for bullet in bullets:
        bullet.update(frame_time)
        for mushroom in monster_list:
            if collision(mushroom, bullet):
                mushroom.hit(character.damage)
                if bullets.count(bullet) > 0:
                    bullets.remove(bullet)
        if bullet.sx > 1000:
            bullets.remove(bullet)

    if character.now_hp <= 0:
        sound.stop()
        game_framework.change_state(GameOver)
예제 #29
0
파일: title_state.py 프로젝트: wonsub/2d_pg
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
        else:
            if event.type == SDL_KEYDOWN:
                game_framework.change_state(main_state)
    pass
예제 #30
0
def update():
    global  logo_time

    if(logo_time > 1.0):
        logo_time = 0
        #game_framework.quit()
        game_framework.change_state(title_state)
    delay(0.01)
    logo_time += 0.01
예제 #31
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_KEYDOWN:
            if event.key == SDLK_r:
                game_framework.change_state(BeginningState)

        if event.type == SDL_QUIT:
            game_framework.quit()
        pass
예제 #32
0
파일: main_state.py 프로젝트: asdf2617/2DPG
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.change_state(title_state)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_p:
            game_framework.push_state(pause_state_second)
    pass
예제 #33
0
def handle_events():
    global running
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            running = False
        elif event.type == SDL_KEYDOWN:
            if event.key == SDLK_ESCAPE:
                game_framework.change_state(title_state)
        mario.handle_event(event)
예제 #34
0
 def update(self):
     global time_time, min_time, plus_time, end_time, end_on
     self.timer = int(get_time())
     self.main_time = self.timer2 - self.timer - min_time + menu_state.menu_time + plus_time
     if self.main_time < 0:
         self.main_time = 0
     time_time = self.main_time
     end_time = self.main_time
     if self.main_time == 0:
         game_framework.change_state(end_state)
예제 #35
0
def update():
    global logo_time

    if(logo_time > 0.5):
        logo_time = 0
        game_framework.change_state(final_stage_state)
    delay(0.01)
    logo_time += 0.0025

    pass
예제 #36
0
def handle_events():
    global running
    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)
        else:
            player.handle_event(event)
예제 #37
0
def update():
    global logo_time

    if logo_time > 1.0:
        logo_time = 0
        game_framework.change_state(title_state)

    delay(0.01)
    logo_time += 0.01
    pass
예제 #38
0
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.change_state(title_state)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_p:
            game_framework.push_state(
                pause_state)  #pause_state를 pause_advanced 로 바꾸면 drill-08_2 실행됨
예제 #39
0
def update():
    global main_change

    if (main_change == False):
        main_change = True
        game_framework.change_state(title_state)
    boy.update()

    delay(0.01)
    handle_events()
예제 #40
0
def update():
    for object in game_world.all_objects():
        if object != boy:
            if collide(boy, object):
                boy.coll()
                save_game_inform()
                game_framework.change_state(rank_state)

    for game_object in game_world.all_objects():
        game_object.update()
예제 #41
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_SPACE):
            game_framework.change_state(title_state)
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_p):
            game_framework.push_state(pause_state)
    pass
예제 #42
0
def update():
    global image, push_time
    if title_time == 0:
        push_time = (push_time + 1) % 40
        if push_time < 20:
            image = load_image('screen/title_floor_fix.png')
        elif push_time > 20 and push_time < 40:
            image = load_image('screen/title_floor_push.png')
    elif title_time == 1:
        game_framework.change_state(event_state)
예제 #43
0
def handle_events():
    events = get_events()
    for e in events:
        if e.type == SDL_QUIT:
            gf.quit()
        else:
            if (e.type, e.key) == (SDL_KEYDOWN, SDLK_ESCAPE):
                gf.quit()
            elif (e.type, e.key) == (SDL_KEYDOWN, SDLK_SPACE):
                gf.change_state(main_state)
예제 #44
0
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_1):
                game_framework.change_state(scene_state_selection)
            elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_2):
                game_framework.change_state(scene_state_selection)
예제 #45
0
def handle_events(frame_time):
    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()
            if (event.type, event.key) == (SDL_KEYDOWN, SDLK_q):
                game_framework.change_state(LaunchState)
예제 #46
0
def handle_events():
    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            background.bgm_state = 0
            game_framework.quit()
        if event.key == SDLK_ESCAPE:
            game_framework.change_state(title_state)
        if event.key == SDLK_m:
            game_framework.change_state(map_tool)
예제 #47
0
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_SPACE:
            game_framework.change_state(Level3_state)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_ESCAPE:
            game_framework.quit()
    pass
예제 #48
0
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.pop_state()
        elif event.type == SDL_KEYDOWN and event.key == SDLK_SPACE:
            title_state.bgm.set_volume(0)
            game_framework.change_state(boss_field_state)
예제 #49
0
def update():
    global logo_time

    if (logo_time > 1.0):
        logo_time = 0
        # game_framework.quit()
        game_framework.change_state(title_state)

    delay(0.01)
    logo_time += 0.01
예제 #50
0
def handle_events():
    global pause
    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)
        elif event.type == SDL_KEYDOWN and event.key == SDLK_p:
            game_framework.pop_state()
예제 #51
0
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(title_state)
            elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_p):
                game_framework.pop_state()
예제 #52
0
def handle_events():
    global x, y

    events = get_events()
    for event in events:
        if event.type == SDL_QUIT:
            game_framework.quit()
        else:
            if (event.type, event.button) == (SDL_KEYDOWN, SDLK_ESCAPE):
                game_framework.change_state(second_logo)
예제 #53
0
def update():
    global crush, boy
    for game_object in game_world.all_objects():
        game_object.update()
    crush = collide(boy, zombie)
    if True == crush:
        with open('ranking.json', 'w') as f:
            boy.start_time = json.dump(f)

        game_framework.change_state(ranking_state)
예제 #54
0
def update():
    global logo, flowTime

    if flowTime >= 3.0:
        import loading_state
        gf.change_state(loading_state)
        handle_events()
    else:
        delay(0.1)
        flowTime += 1.0
예제 #55
0
def handle_events(frame_time):
    global miko
    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)
        else:
            miko.handle_event(event)
예제 #56
0
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.change_state(title_state)
        elif (event.type, event.key) == (SDL_KEYDOWN, SDLK_p):
            #game_framework.push_state(luxury_pause_state)
            game_framework.push_state(advanced_pause_state)
예제 #57
0
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.change_state(level_select_state)
        else:
            player.handle_event(event)
    pass
예제 #58
0
def update():
    global logo_time

    if (logo_time > 1.0):
        logo_time = 0
        # game_framework.quit()
        game_framework.change_state(Main_Screen)
    delay(0.01)
    logo_time += 0.01
    pass
예제 #59
0
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.change_state(main_state)
예제 #60
0
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.change_state(end_state_win)
            #game_framework.quit()
        else:
            bacteria.handle_event(event)