본문 바로가기
Programming/Renpy

렌파이 이미지 갤러리

by Devsaurus 2024. 1. 25.
728x90

이미지 갤러리, 음악 룸, 및 재생 동작

이미지 갤러리

이미지 갤러리는 플레이어가 이미지를 해제하고 그 이미지를 볼 수 있는 화면입니다. 화면에는 하나 이상의 버튼이 있으며, 각 버튼에는 하나 이상의 이미지가 연결되어 있습니다. 또한 버튼과 이미지에는 잠금 여부를 결정하는 조건도 있습니다.

이미지 갤러리는 Gallery 클래스의 인스턴스로 관리됩니다. 이 클래스의 단일 인스턴스는 여러 이미지 갤러리 화면에서 공유될 수 있습니다.

갤러리는 하나 이상의 버튼이 연결되어 있으며, 버튼은 하나 이상의 이미지가 연결되어 있습니다. 각 이미지는 하나 이상의 디스플레이 가능한 항목과 연결되어 있습니다. 버튼은 해당 버튼에 연결된 모든 조건이 충족되고 해당 버튼과 연결된 이미지 중 적어도 하나가 해제될 때 잠금이 해제됩니다. 이미지는 연결된 모든 조건이 충족되면 해제됩니다.

이미지 갤러리를 만드는 과정은 다음 네 단계로 이루어집니다.

  1. Gallery 인스턴스 생성:

    g = Gallery()
  2. 갤러리에 버튼 및 이미지 추가:

    g.button("title")
    g.image("title")
    
    g.button("dawn")
    g.image("dawn1")
    g.unlock("dawn1")
    
    g.button("dark")
    g.unlock_image("bigbeach1")
    g.transform(slowpan)
    g.unlock_image("beach1 mary")
    g.unlock_image("beach2")
    g.unlock_image("beach3")
    
    g.button("end1")
    g.condition("persistent.unlock_1")
    g.image("transfer")
    g.image("moonpic")
    g.image("girlpic")
    g.image("nogirlpic")
    g.image("bad_ending")
    
    g.button("end2")
    g.condition("persistent.unlock_2")
    g.image("library")
    g.image("beach1 nomoon")
    g.image("bad_ending")
    
    g.button("end3")
    g.condition("persistent.unlock_3")
    g.image("littlemary2")
    g.image("littlemary")
    g.image("good_ending")
    g.condition("persistent.unlock_3 and persistent.unlock_4")
    
    g.button("end4")
    g.condition("persistent.unlock_4")
    g.image("hospital1")
    g.image("hospital2")
    g.image("hospital3")
    g.image("heaven")
    g.image("white")
    g.image("good_ending")
    
    g.condition("persistent.unlock_3 and persistent.unlock_4")
    
    g.button("dawn mary")
    g.unlock_image("dawn1", "mary dawn wistful")
    g.unlock_image("dawn1", "mary dawn smiling")
    g.unlock_image("dawn1", "mary dawn vhappy")
    
    g.button("dark mary")
    g.unlock_image("beach2", "mary dark wistful")
    g.unlock_image("beach2", "mary dark smiling")
    g.unlock_image("beach2", "mary dark vhappy")
    
    g.transition = dissolve
  3. 이미지 갤러리 화면 생성:

    screen gallery:
        tag menu
        add "beach2"
    
        grid 3 3:
            xfill True
            yfill True
    
            add g.make_button("dark", "gal-dark.png", xalign=0.5, yalign=0.5)
            add g.make_button("dawn", "gal-dawn.png", xalign=0.5, yalign=0.5)
            add g.make_button("end1", "gal-end1.png", xalign=0.5, yalign=0.5)
    
            add g.make_button("end2", "gal-end2.png", xalign=0.5, yalign=0.5)
            add g.make_button("end3", "gal-end3.png", xalign=0.5, yalign=0.5)
            add g.make_button("end4", "gal-end4.png", xalign=0.5, yalign=0.5)
    
            add g.make_button("dark mary", "gal-dark_mary.png", xalign=0.5, yalign=0.5)
            add g.make_button("dawn mary", "gal-dawn_mary.png", xalign=0.5, yalign=0.5)
            add g.make_button("title", "title.png", xalign=0.5, yalign=0.5)
    
        textbutton "Return" action Return() xalign 0.5 yalign 0.5
  4. 메인 메뉴에 갤러리 화면 표시 추가:

    # 게임 구조에 따라 다르게 변할 수 있음
    textbutton "Gallery" action ShowMenu("gallery")

    이를 메인 메뉴 화면에 추가합니다.

728x90