不多做介绍,就是强化的字幕滚动。
范例截图:
范例下载:
01
SkyDrive下载(请自行更改后辍名为*.rar即可)
02
脚本:
- =begin说明:01 把字幕强化了,添加对话框的一些功能到里头去。 \f[字体]:更改字体 \c[颜色]:更改颜色,与默认对话框相同 \s[字体大小]:更改字体大小 \p[图片名称]:显示在picture文件夹下指定的图片 字幕:被包围的字将会变成粗体 字幕:被包围的字将会变成斜体 :该行左边对齐 :该行中间对齐 :该行右边对齐02 调用方法:(1) $scene = Scene_Credit.new (2) $scene = Scene_Credit.new("文字") (1) 为默认调用发,字幕会直接读取脚本里设定好的字幕 (2) 为更改字幕,字幕将变成设定的文字,支持\txt[TXT名称],将会读取 Credit文件夹底下的指定TXT,TXT格式参考范例。03 其他玩转设置参考范例。=endmodule CREDIT# 字幕Subtitle= width ? _temp_bitmap.width : width height += _temp_bitmap.height end _temp_bitmap.clear _temp_bitmap.dispose _temp_bitmap = nil end elsif c == "\201" temp_bitmap.font.bold = @font_bold = true elsif c == "\202" temp_bitmap.font.bold = @font_bold = false elsif c == "\203" temp_bitmap.font.italic = @font_italic = true elsif c == "\204" temp_bitmap.font.italic = @font_italic = false else if Subtitle_move == "y" width += temp_bitmap.text_size(c).width height = temp_bitmap.text_size(c).height > height ?\ temp_bitmap.text_size(c).height : height else width = temp_bitmap.text_size(c).width > width ?\ temp_bitmap.text_size(c).width : width height += temp_bitmap.text_size(c).height end end end if Subtitle_move == "y" height = DefaultLineHeight if height < DefaultLineHeight width = 32 if width == 0 else width = DefaultLineHeight if width < DefaultLineHeight height = 32 if height == 0 end temp_bitmap.clear temp_bitmap.dispose temp_bitamp = nil return width,height end def create_line_bitmap(line,width,height) temp_bitmap = Bitmap.new(width,height) temp_bitmap.font.name = @font_name temp_bitmap.font.size = @font_size temp_bitmap.font.color = @font_color temp_bitmap.font.bold = @font_bold temp_bitmap.font.italic = @font_italic x = 0 line = line.dup line.gsub!(/\/){"\101"} line.gsub!(/\/){"\102"} line.gsub!(/\/){"\100"} line.gsub!(/\\\\/){"\000"} line.gsub!(/\\[Ff]\[(\w+)\]/){"\001[#{$1}]"} line.gsub!(/\\[Cc]\[(\d+)\]/){"\002[#{$1}]"} line.gsub!(/\\[Ss]\[(\d+)\]/){"\003[#{$1}]"} line.gsub!(/\\[Pp]\[(\w+)\]/){"\004[#{$1}]"} line.gsub!(/\/){"\201"} line.gsub!(/\/){"\202"} line.gsub!(/\/){"\203"} line.gsub!(/\/){"\204"} while ((c = line.slice!(/./m)) != nil) if c == "\100" @align = 0 elsif c == "\101" @align = 1 elsif c == "\102" @align = 2 elsif c == "\000" c = "\" elsif c == "\001" line.sub!(/\[(\w+)\]/,"") font_name = $1 == nil ? Font_name : $1 temp_bitmap.font.name = @font_name = font_name elsif c == "\002" line.sub!(/\[(\d+)\]/,"") font_color = $1 == nil ? 0 : $1.to_i case font_color when 1 temp_bitmap.font.color = @font_color = Color.new(128,128,255) when 2 temp_bitmap.font.color = @font_color = Color.new(255,128,128) when 3 temp_bitmap.font.color = @font_color = Color.new(128,255,128) when 4 temp_bitmap.font.color = @font_color = Color.new(128,255,255) when 5 temp_bitmap.font.color = @font_color = Color.new(255,128,255) when 6 temp_bitmap.font.color = @font_color = Color.new(255,255,128) when 7 temp_bitmap.font.color = @font_color = Color.new(192,192,192) else temp_bitmap.font.color = @font_color = Color.new(255,255,255) end elsif c == "\003" line.sub!(/\[(\d+)\]/,"") font_size = $1 == nil ? @font_size : [[$1.to_i,16].max,96].min temp_bitmap.font.size = @font_size = font_size elsif c == "\004" line.sub!(/\[(\w+)\]/,"") bitmap_name = $1 == nil ? "" : $1 if bitmap_name != "" _temp_bitmap = RPG::Cache.picture(bitmap_name) rect = Rect.new(0,0,_temp_bitmap.width,_temp_bitmap.height) if Subtitle_move == "y" temp_bitmap.blt(x,height/2-_temp_bitmap.height/2,_temp_bitmap,rect) else temp_bitmap.blt(width/2-_temp_bitmap.width/2,x,_temp_bitmap,rect) end _temp_bitmap.clear _temp_bitmap.dispose _temp_bitmap = nil end elsif c == "\201" temp_bitmap.font.bold = @font_bold = true elsif c == "\202" temp_bitmap.font.bold = @font_bold = false elsif c == "\203" temp_bitmap.font.italic = @font_italic = true elsif c == "\204" temp_bitmap.font.italic = @font_italic = false else if Subtitle_move == "y" temp_bitmap.draw_text(x,0,temp_bitmap.text_size(c).width,height,c) x += temp_bitmap.text_size(c).width else temp_bitmap.draw_text(0,x,width,temp_bitmap.text_size(c).height,c,1) x += temp_bitmap.text_size(c).height end end end return temp_bitmap endend复制代码
复制代码 本帖来自P1论坛作者enghao_lim,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=162889 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。