马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
具体讲解请看视频,代码如下。
[RenPy] 纯文本查看 复制代码 init python:
def tw_sfx(event, **kwargs):
if event == "show":
renpy.music.play("audio/typewriter.mp3", channel="sound", loop=True)
elif event == "slow_done" or event == "end":
renpy.music.stop(channel="sound")
image ctc_blink:
Solid("#0ff")
xysize (10, 20)
linear 0.5 alpha 1.0
linear 0.5 alpha 0.0
repeat
define tw = Character("tw", who_color="#c8ffc8", callback=tw_sfx,
ctc="ctc_blink", ctc_position="nestled")
define e = Character("Eileen", who_color="#f479c1")
## 制作者:b站 黑凤梨BlackPineappl
## [url]https://space.bilibili.com/628485868[/url]
label start:
scene bg bedroom
show expression Text("反派大小姐选择重开",color="#020202", size=60, xalign=0.5,yalign=0.23,slow_cps=8)
pause
"{cps=20}固定速度{/cps} {cps=*2}两倍速{/cps}"
$ preferences.text_cps = 5
tw "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
pause
tw "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
$ preferences.text_cps = 0
e "test"
$ preferences.text_cps = 5
tw "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
return
UDD版本,作者 被诅咒的章鱼
[RenPy] 纯文本查看 复制代码 image point:
Solid("#0ff")
xysize(10, 30)
linear 0.2 alpha 1.0
linear 0.2 alpha 0.0
repeat
init python:
test_text = "文本显示测试。文本显示测试。文本显示测试。文本显示测试。文本显示测试。文本显示测试。文本显示测试。文本显示测试。"
typer_hint = "point"
def get_text_with_typer_hint(str, typer_hint):
return str + "{image=" + typer_hint + "}"
class TyperText(renpy.Displayable):
def __init__(self, child, typer_gap, typer_hint, **kwargs):
super(TyperText, self).__init__(**kwargs)
self.child = Text(child)
self.all_text = child.get_all_text()
self.typer_gap = typer_gap
self.typer_hint = typer_hint
def render(self, width, height, st, at):
end_str_index = min( int(st / self.typer_gap), len(self.all_text))
sub_str = self.all_text[0:end_str_index] + "{image=" + self.typer_hint + "}"
self.child.set_text(sub_str)
t = Transform(child=self.child)
child_render = renpy.render(t, width, height, st, at)
self.width, self.height = child_render.get_size()
render = renpy.Render(self.width, self.height)
render.blit(child_render, (0, 0))
renpy.redraw(self, 0)
return render
image grey = "#5f5f5f"
screen text_typer_screen:
add TyperText(Text(test_text), 0.5, typer_hint)
# label main_menu:
# return
## 代码作者:被诅咒的章鱼
## 教程制作者:b站 黑凤梨BlackPineappl
## [url]https://space.bilibili.com/628485868[/url]
label start:
scene grey
"......"
play music "audio/typewriter.mp3" loop
call screen text_typer_screen
"......"
return
|