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!