顯示具有 RenPy 標籤的文章。 顯示所有文章
顯示具有 RenPy 標籤的文章。 顯示所有文章

7.12.2011

Renpy 與 python

renpy可以用'$'或'python:'來插入python的程式碼,
不過注意,不要用來'import' pyhon的library,
否則很容易造成 遊戲存檔失效,
如果要'import'一些額外的library,
請在'init python:'中加入即可。

7.09.2011

Renpy 6.12.1: How do I show a variable in the text?

要怎麼在對話的text中秀出變數,Renpy 官網提供以下三種方法:
$ food = "apple sauce"

"I would like to try some %(food)s, please."
"I would like to try some %s, please." % food
"I would like to try some " + food + ", please."
 不過,我在Renpy 6.12.1試的結果,目前只支援第一種:
"I would like to try some %(food)s, please."

其它兩種,不確定以前有沒有支援,目前看來是不行用的。

7.02.2011

Renpy 6.12.1: Drag and Drop

Renpy 6.12.1支援滑鼠托拉(Drag and Drop)的功能,
官網有範例,不過若直接複製貼上範例code,
會發現有些小錯誤:
1. 請將drag_group改成draggroup
2. 去下載圖片,裡面的圖記得改成自己圖片的名稱

修改後範例如下:

init python:

    def detective_dragged(drags, drop):

        if not drop:
            return

        store.detective = drags[0].drag_name
        store.city = drop.drag_name

        return True

screen send_detective_screen:

    # A map as background.
    add "europe.jpg"

    # A drag group ensures that the detectives and the cities.
    draggroup:

        # Our detectives.
        drag:
            drag_name "Ivy"
            child "ivy.png"
            droppable False
            dragged detective_dragged
            xpos 100 ypos 100
        drag:
            drag_name "Zack"
            child "zack.png"
            droppable False
            dragged detective_dragged
            xpos 150 ypos 100

        # The cities they can go to.
        drag:
            drag_name "London"
            child "london.png"
            draggable False
            xpos 450 ypos 140
        drag:
            drag_name "Paris"
            draggable False
            child "paris.png"
            xpos 500 ypos 280

label send_detective:
    "We need to investigate! Who should we send, and where should they go?"

    call screen send_detective_screen

    "Okay, we'll send %(detective)s to %(city)s."

8.06.2010

Ren'Py 6.11.0 超新手的圖形化時鐘範例(in windows)

Ren'Py可以加入圖形化時鐘,
可參考:Adding a simple and somewhat functioning Analog Clock(英文)
不過不小修改這個範例 ,直接用這個code在Ren'Py 6.11.0卻不能執行。
所以我把修改後,可以在Ren'Py 6.11.0下執行的code公開,
主要是renpy.image(name,image)需要兩個參數,
其它只是一些小修改。


#script.rpy code 
init python: 
    clock = False
    minutes = 540
    renpy.image("clock","Clock.png") # Short Clockhand
    renpy.image("clock_1","Clock_1.png") # Long Clockhand
    renpy.image("clock_2","Clock_2.png") # Clockface
  
    def Clock():
        if clock: # if False - clock is hide
            ui.at(Position(xpos=150, ypos=140, xanchor="center", yanchor="center"))
            ui.add("clock_2")
            # xalign and yalign can be replaced by xpos and ypos - position where the center of the clock should be
            # this segment is the one responsible for the clockface

            ui.at(Position(xpos=150, ypos=140, xanchor="center", yanchor="center"))
            ui.at(RotoZoom((minutes*6), (minutes*6), 5.0, 1, 1, 1, rot_bounce= False, rot_anim_timebase=False, opaque=False), )
            ui.add("clock")
            # this segment is the one responsible for the short clock hand.

            ui.at(Position(xpos=150, ypos=140, xanchor="center", yanchor="center"))
            ui.at(RotoZoom ((minutes*0.5), (minutes*0.5), 5.0, 1, 1, 1, rot_bounce= False, rot_anim_timebase=False, opaque=False))
            ui.add("clock_1")
            # this segment is the one responsible for the long clock hand.

    config.overlay_functions.append(Clock)



init:
label start:

    $ clock = True
    with dissolve


#End of script.rpy 

另外就是Clock.png, Clock_1.png及Clock_2.png請放在
../renpy-6.11.0/common/
注意圖形檔案及檔名不要錯了哦。

8.01.2010

Ren'Py 6.11.0 超新手中文顯示簡介 (in windows)

Ren'Py是一個免費跨平台的AVG(視覺小說)製作軟体,
介面沒有商業軟体的戀愛遊戲製作大師二,來得人性化,
不過戀二已經是很久以前的軟体了,而且是商業軟体,
所以除了人性化外,很多方面不如Ren'Py,
而Ren'Py最大的特點是以英文為主,
所以如何中文顯示,就成為新手面臨的一大課題,
網路上有許多中文顯示的文件,
不過大多數都已經過舊,
新版的Ren'Py顯示中文,其實很簡單:
1. (Optional)首先下載開源的中文字型(如文泉驛中文字体)
2. 將字型放到程式下的common目錄下。
3. 建一project,去修改 遊戲所在資料夾中,option.rpy

style.default.font = "fontname.ttf"


這邊fontname.ttf即是中文字型檔檔名
(參:http://www.renpy.org/wiki/renpy/doc/FAQ#How_do_I_change_the_default_font.3F)

此時,你Select Project且Launch之後,成功的話,
就可以看到中文了。
額外的中文修改(可能有其用途,不清楚)
參考:http://www.renpy.org/wiki/renpy/doc/cookbook/Chinese_and_Japanese

Good Luck!