Project1

标题: [发布][应求脚本]仿"星球大战"字幕 [打印本页]

作者: SailCat    时间: 2005-10-27 09:46
标题: [发布][应求脚本]仿"星球大战"字幕


用法:
插入到Main前面
游戏调用:
事件脚本: $scene=Scene_Opening.new(返回场景)
例: $scene=Scene_Opening.new(Scene_Title.new)

若省略参数的话为默认场景

设定:
CREDIT常量:要显示的文字,这里拿星球大战作示范了
其他见脚本注释

  1. #——————————————————————————————————————
  2. # Scene_Opening 开场字幕 by SailCat
  3. #——————————————————————————————————————


  4. #——使用注意:默认会返回地图,如果需要返回开头,请将本脚本中的
  5. #return_scene = Scene_Map.new改为return_scene = Scene_Title.new

  6. class Scene_Opening
  7.   CREDIT=<<_END_

  8. Star Wars

  9. EPISODE IV
  10. A New Hope

  11. It is a period of civil war. Rebel
  12. spaceships, striking from a hidden
  13. base, have won their first victory
  14. against the evil Galactic Empire.

  15.   During the battle, Rebel spies  
  16. managed to steal secret plans to  
  17. the Empire's ultimate weapon, the
  18. DEATH STAR, an armored space      
  19. station with enough power to      
  20. destroy an entire planet.         

  21.   Pursued by the Empire's sinister
  22. agents, Princess Leia races home  
  23. aboard her starship,custodian of  
  24. the stolen plans that can save her
  25. people and restore freedom to the
  26. galaxy....
  27. _END_
  28. end

  29. class Scene_Opening

  30.   def initialize(return_scene = nil)
  31.     @sprite = Sprite.new
  32.     back_bitmap =  Bitmap.new("Graphics/Panoramas/003-StarlitSky01.jpg")
  33.     @sprite.bitmap = Bitmap.new(640, 480)
  34.     @sprite.bitmap.stretch_blt(Rect.new(0, 0, 640, 480), back_bitmap,
  35.       Rect.new(0, 0, back_bitmap.width, back_bitmap.height))
  36.     @sprite.x = 0
  37.     @sprite.y = 0
  38.     @wait_count = 0
  39.     Graphics.freeze
  40.     Graphics.transition(20)
  41.     $game_temp.map_bgm = $game_system.playing_bgm
  42.     # 如果要播放音乐的话更改以下两行(文件名)并去掉注释
  43.     #opening_bgm=RPG::AudioFile.new("Audio/BGM/Star Wars.mid", 100, 100)
  44.     #$game_system.bgm_play(opening_bgm)
  45.     if return_scene.nil?
  46.       return_scene = Scene_Map.new
  47.       $game_temp.transition_processing = true
  48.       $game_temp.transition_name = ""
  49.     end
  50.     @return_scene = return_scene
  51.   end
  52.   
  53.   def scene_start
  54.     credit_lines = CREDIT.split(/\n/)
  55.     @credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
  56.     # 这里更改描绘字体 美观起见请用等宽字体
  57.     @credit_bitmap.font.name = ["Courier New", "黑体"]
  58.     @credit_bitmap.font.size = 24
  59.     @credit_bitmap.font.bold = true
  60.     credit_lines.each_index do |i|
  61.       line = credit_lines[i]
  62.       @credit_bitmap.draw_text(0,i * 32,640,32,line,1)
  63.     end
  64.     @credit_sprite = Sprite.new(Viewport.new(0,240,640,240))
  65.     @credit_sprite.bitmap = Bitmap.new(960,240)
  66.     @credit_sprite.ox = 160
  67.     @frame_index = 0
  68.     @last_flag = false
  69.   end

  70.   def scene_end
  71.     @credit_sprite.dispose
  72.     @sprite.dispose
  73.     $game_system.bgm_stop
  74.     $game_system.bgm_play($game_temp.map_bgm)
  75.   end
  76.   
  77.   def last?
  78.     return (@frame_index >= @credit_bitmap.height + 240)
  79.   end
  80.   
  81.   def last
  82.     if not @last_flag
  83.       @last_flag = true
  84.       @last_count = 0
  85.       Audio.bgm_fade(5000)
  86.     else
  87.       @last_count += 1
  88.     end
  89.     if @last_count >= 100
  90.       $scene = @return_scene
  91.     end
  92.   end
  93.   
  94.   def update
  95.     if @wait_count > 0
  96.       @wait_count -= 1
  97.       return
  98.     end
  99.     @frame_index += 1
  100.     return if cancel?
  101.     last if last?
  102.     update_bitmap
  103.     @wait_count = 2
  104.   end

  105.   def cancel?
  106.     if Input.trigger?(Input::B)
  107.       $scene = @return_scene
  108.       return true
  109.     end
  110.     return false
  111.   end
  112.   
  113.   # 刷新文字梯形
  114.   def update_bitmap
  115.     @credit_sprite.bitmap.clear
  116.     for i in 0..240
  117.       if i + @frame_index >= 240
  118.         @credit_sprite.bitmap.stretch_blt(Rect.new(240-i, i, 480+i*2, 1),
  119.           @credit_bitmap, Rect.new(0, @frame_index+i-240, 640, 1))
  120.       end
  121.     end
  122.   end

  123.   def main
  124.     scene_start
  125.     # 过渡
  126.     Graphics.transition
  127.     # 主循环
  128.     loop do
  129.       Graphics.update
  130.       Input.update
  131.       update
  132.       if $scene != self
  133.         break
  134.       end
  135.     end
  136.     # 准备过渡
  137.     Graphics.freeze
  138.     scene_end
  139.   end
  140. end

复制代码


              [本贴由 柳柳 于 2005-10-28 6:20:56 最后编辑]
作者: SailCat    时间: 2005-10-27 09:46
标题: [发布][应求脚本]仿"星球大战"字幕


用法:
插入到Main前面
游戏调用:
事件脚本: $scene=Scene_Opening.new(返回场景)
例: $scene=Scene_Opening.new(Scene_Title.new)

若省略参数的话为默认场景

设定:
CREDIT常量:要显示的文字,这里拿星球大战作示范了
其他见脚本注释

  1. #——————————————————————————————————————
  2. # Scene_Opening 开场字幕 by SailCat
  3. #——————————————————————————————————————


  4. #——使用注意:默认会返回地图,如果需要返回开头,请将本脚本中的
  5. #return_scene = Scene_Map.new改为return_scene = Scene_Title.new

  6. class Scene_Opening
  7.   CREDIT=<<_END_

  8. Star Wars

  9. EPISODE IV
  10. A New Hope

  11. It is a period of civil war. Rebel
  12. spaceships, striking from a hidden
  13. base, have won their first victory
  14. against the evil Galactic Empire.

  15.   During the battle, Rebel spies  
  16. managed to steal secret plans to  
  17. the Empire's ultimate weapon, the
  18. DEATH STAR, an armored space      
  19. station with enough power to      
  20. destroy an entire planet.         

  21.   Pursued by the Empire's sinister
  22. agents, Princess Leia races home  
  23. aboard her starship,custodian of  
  24. the stolen plans that can save her
  25. people and restore freedom to the
  26. galaxy....
  27. _END_
  28. end

  29. class Scene_Opening

  30.   def initialize(return_scene = nil)
  31.     @sprite = Sprite.new
  32.     back_bitmap =  Bitmap.new("Graphics/Panoramas/003-StarlitSky01.jpg")
  33.     @sprite.bitmap = Bitmap.new(640, 480)
  34.     @sprite.bitmap.stretch_blt(Rect.new(0, 0, 640, 480), back_bitmap,
  35.       Rect.new(0, 0, back_bitmap.width, back_bitmap.height))
  36.     @sprite.x = 0
  37.     @sprite.y = 0
  38.     @wait_count = 0
  39.     Graphics.freeze
  40.     Graphics.transition(20)
  41.     $game_temp.map_bgm = $game_system.playing_bgm
  42.     # 如果要播放音乐的话更改以下两行(文件名)并去掉注释
  43.     #opening_bgm=RPG::AudioFile.new("Audio/BGM/Star Wars.mid", 100, 100)
  44.     #$game_system.bgm_play(opening_bgm)
  45.     if return_scene.nil?
  46.       return_scene = Scene_Map.new
  47.       $game_temp.transition_processing = true
  48.       $game_temp.transition_name = ""
  49.     end
  50.     @return_scene = return_scene
  51.   end
  52.   
  53.   def scene_start
  54.     credit_lines = CREDIT.split(/\n/)
  55.     @credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
  56.     # 这里更改描绘字体 美观起见请用等宽字体
  57.     @credit_bitmap.font.name = ["Courier New", "黑体"]
  58.     @credit_bitmap.font.size = 24
  59.     @credit_bitmap.font.bold = true
  60.     credit_lines.each_index do |i|
  61.       line = credit_lines[i]
  62.       @credit_bitmap.draw_text(0,i * 32,640,32,line,1)
  63.     end
  64.     @credit_sprite = Sprite.new(Viewport.new(0,240,640,240))
  65.     @credit_sprite.bitmap = Bitmap.new(960,240)
  66.     @credit_sprite.ox = 160
  67.     @frame_index = 0
  68.     @last_flag = false
  69.   end

  70.   def scene_end
  71.     @credit_sprite.dispose
  72.     @sprite.dispose
  73.     $game_system.bgm_stop
  74.     $game_system.bgm_play($game_temp.map_bgm)
  75.   end
  76.   
  77.   def last?
  78.     return (@frame_index >= @credit_bitmap.height + 240)
  79.   end
  80.   
  81.   def last
  82.     if not @last_flag
  83.       @last_flag = true
  84.       @last_count = 0
  85.       Audio.bgm_fade(5000)
  86.     else
  87.       @last_count += 1
  88.     end
  89.     if @last_count >= 100
  90.       $scene = @return_scene
  91.     end
  92.   end
  93.   
  94.   def update
  95.     if @wait_count > 0
  96.       @wait_count -= 1
  97.       return
  98.     end
  99.     @frame_index += 1
  100.     return if cancel?
  101.     last if last?
  102.     update_bitmap
  103.     @wait_count = 2
  104.   end

  105.   def cancel?
  106.     if Input.trigger?(Input::B)
  107.       $scene = @return_scene
  108.       return true
  109.     end
  110.     return false
  111.   end
  112.   
  113.   # 刷新文字梯形
  114.   def update_bitmap
  115.     @credit_sprite.bitmap.clear
  116.     for i in 0..240
  117.       if i + @frame_index >= 240
  118.         @credit_sprite.bitmap.stretch_blt(Rect.new(240-i, i, 480+i*2, 1),
  119.           @credit_bitmap, Rect.new(0, @frame_index+i-240, 640, 1))
  120.       end
  121.     end
  122.   end

  123.   def main
  124.     scene_start
  125.     # 过渡
  126.     Graphics.transition
  127.     # 主循环
  128.     loop do
  129.       Graphics.update
  130.       Input.update
  131.       update
  132.       if $scene != self
  133.         break
  134.       end
  135.     end
  136.     # 准备过渡
  137.     Graphics.freeze
  138.     scene_end
  139.   end
  140. end

复制代码


              [本贴由 柳柳 于 2005-10-28 6:20:56 最后编辑]
作者: 夕俊    时间: 2005-10-27 14:15
提示: 作者被禁止或删除 内容自动屏蔽
作者: bluefool    时间: 2005-10-27 19:00
sailcat还真是敬业的好版主啊........

表太累了{/wx}{/wx}{/wx}
作者: orochi2k    时间: 2005-10-28 01:04
楼上很可疑哦....
作者: 忧郁    时间: 2005-10-28 02:08
效率好高啊.......CAT姐偶崇拜死你了!
作者: 小鼻涕    时间: 2005-10-28 03:45
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1