Project1

标题: Logo脚本(VX&VA) [打印本页]

作者: 我的米呀    时间: 2014-5-18 20:46
标题: Logo脚本(VX&VA)
[ 本帖最后由 我的米呀 于 2014-5-20 23:06 编辑 ]\n\n
       顾名思义,可以给你的游戏在标题画面前插入一个Logo画面,过去普遍的做法可能是用跳过标题画面这个脚本,但是那个有时在测试时可能不是特别方便,所以有了这个脚本。

本脚本的使用方法:
#   1.将此脚本插入Main脚本之前。   
#   2.将Logo图片放入“Graphics/System/”文件夹。
#   3.将Logo音乐放入“Audio/ME/”文件夹。
#   4将LOGO_MUSIC和LOGO_PICTURE名称修改为Logo图片和Logo音乐文件名。
#   5.将LOGO_SPEED数值设定为你要淡入淡出的速度,将LOGO_WAIT数值设定为淡入淡出间隔的帧数。
#   6.在游戏中可按取消键跳过标题画面。

×另,本脚本已默认在测试环境下不运行LOGO画面,如果想取消这个设定,就请搜索$TEST

【VX按本】

将如下脚本:
RUBY 代码复制
  1. if $TEST
  2.   $scene = Scene_Title.new  
  3. else
  4.   $scene = Scene_Logo.new
  5.   end

修改为:
RUBY 代码复制
  1. $scene = Scene_Logo.new

即可。

【VA]版本】

搜索以下语句:
RUBY 代码复制
  1. if $Logo == true or $TEST

改为
RUBY 代码复制
  1. if $Logo == true


请注意,共有两处。



VX版本

RUBY 代码复制
  1. #==============================================================================
  2. # ** Logo  V1.01 by SUPERNOVA Games
  3. #
  4. #    标题画面 by SUPERNOVA Games
  5. #==============================================================================
  6. #
  7. # How to use:
  8. #   1.Add this script above Main.   
  9. #   2.Put your own logo picture in Graphics/System/.
  10. #   3.Put your own logo music in Audio/ME/.
  11. #   4.Change LOGO_PICTURE & LOGO_MUSIC's filename as
  12. #     your music and pictre's name.
  13. #   5. Set logo's fadein/fadeout speed  and the waiting time between fadein/fadeout as your wish.
  14. #   6.In game press Input B to skip logo.
  15. #
  16. # 如何使用:
  17. #   1.将此脚本插入Main脚本之前。   
  18. #   2.将Logo图片放入“Graphics/System/”文件夹。
  19. #   3.将Logo音乐放入“Audio/ME/”文件夹。
  20. #   4将LOGO_MUSIC和LOGO_PICTURE名称修改为Logo图片和Logo音乐文件名。
  21. #   5.将LOGO_SPEED数值设定为你要淡入淡出的速度,将LOGO_WAIT数值设定为淡入淡出间隔的帧数。
  22. #   6.在游戏中可按取消键跳过标题画面。
  23. #==============================================================================
  24. module SUPERNOVA
  25.   LOGO_MUSIC = "Logo"      #logo music
  26.   LOGO_PICTURE = "Logo"  #logo image
  27.   LOGO_SPEED = 50   #fadein/fadeout speed
  28.   LOGO_WAIT = 100   #waiting time between fadein/fadeout
  29. end
  30. #==============================================================================
  31. # ** Scene_Logo
  32. #==============================================================================
  33. class Scene_Logo < Scene_Base
  34.   #--------------------------------------------------------------------------
  35.   # * Start processing
  36.   #--------------------------------------------------------------------------
  37.   def start
  38.     super
  39.     Audio.me_play("Audio/ME/" + SUPERNOVA::LOGO_MUSIC, 100, 100)
  40.     create_logo_graphic  
  41.     @logo_fadein = true
  42.     @logo_fadeout = false
  43.     @logo_quick_exit = false
  44.     @wait_count = 0
  45.     @logo_speed = SUPERNOVA::LOGO_SPEED
  46.     @logo_wait = SUPERNOVA::LOGO_WAIT
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Termination Processing
  50.   #--------------------------------------------------------------------------
  51.   def terminate
  52.     super
  53.     $Logo = true
  54.     dispose_logo_graphic
  55.    end
  56.   #--------------------------------------------------------------------------
  57.   # * Frame Update
  58.   #--------------------------------------------------------------------------
  59.   def update
  60.     super
  61.      @wait_count += 1
  62.      update_logo_wait
  63.     if @logo_fadein == true
  64.       update_logo_fadein      
  65.     end   
  66.     if @logo_fadeout == true
  67.       update_logo_fadeout   
  68.     end
  69.     if @logo_quick_exit == true
  70.       update_quick_exit
  71.     end
  72.     if Input.trigger?(Input::B)
  73.       @logo_quick_exit = true
  74.     end
  75.   end  
  76.   #--------------------------------------------------------------------------
  77.   # * Update Logo Fadein
  78.   #--------------------------------------------------------------------------
  79.   def update_logo_fadein
  80.     @logo.opacity += @logo_speed if @logo.opacity < 255
  81.   end   
  82.   #--------------------------------------------------------------------------
  83.   # * Update Logo Fadeout
  84.   #--------------------------------------------------------------------------
  85.   def update_logo_fadeout
  86.     @logo.opacity -= @logo_speed if @logo.opacity > 0  
  87.     if @logo.opacity == 0
  88.       Audio.me_stop
  89.       Audio.se_stop
  90.       $scene = Scene_Title.new           
  91.       return      
  92.     end
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * Update Quick Exit
  96.   #--------------------------------------------------------------------------
  97.   def update_quick_exit
  98.    if @logo_quick_exit == true
  99.     @logo.opacity -= 20 if @logo.opacity > 0   
  100.     if @logo.opacity == 0
  101.       Audio.me_stop
  102.       Audio.se_stop
  103.       $scene = Scene_Title.new           
  104.       return      
  105.     end
  106.    end
  107. end
  108.   #--------------------------------------------------------------------------
  109.   # * Update Logo Wait
  110.   #--------------------------------------------------------------------------
  111.    def update_logo_wait
  112.      if  @logo_quick_exit == true
  113.      @logo_fadein = false
  114.      @logo_fadeout = false
  115.       else
  116.      @logo_fadein = true if @wait_count <= @logo_wait + 255/@logo_speed
  117.      @logo_fadeout = false  if @wait_count <= @logo_wait + 255/@logo_speed
  118.      @logo_fadein = false if @wait_count > @logo_wait + 255/@logo_speed
  119.      @logo_fadeout = true  if @wait_count > @logo_wait + 255/@logo_speed
  120.      end
  121.    end
  122.   #--------------------------------------------------------------------------
  123.   # * Create Logo Graphic
  124.   #--------------------------------------------------------------------------
  125.   def create_logo_graphic
  126.     @logo = Sprite.new
  127.     @logo.bitmap  = Cache.system(SUPERNOVA::LOGO_PICTURE)           
  128.     @logo.opacity = 0
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # * Dispose Logo Graphic
  132.   #--------------------------------------------------------------------------
  133.   def dispose_logo_graphic
  134.     @logo.bitmap.dispose
  135.   end
  136. end
  137. #==============================================================================
  138. # ** Main
  139. #------------------------------------------------------------------------------
  140. #  After defining each class, actual processing begins here.
  141. #==============================================================================
  142. Font.default_name = ["SimHei", "黑体", "DFKai-SB", "標楷體", "Verdana", "Arial Unicode MS"]
  143. begin
  144.   Graphics.freeze
  145.   if $TEST
  146.   $scene = Scene_Title.new  
  147. else
  148.   $scene = Scene_Logo.new
  149.   end
  150.   $scene.main while $scene != nil
  151.   Graphics.transition(30)
  152. rescue Errno::ENOENT
  153.   filename = $!.message.sub("No such file or directory - ", "")
  154.   print("Unable to find file #{filename}.")
  155. end




VA版本
RUBY 代码复制
  1. #==============================================================================
  2. # ** Logo V1.01 by SUPERNOVA Games   
  3. #
  4. #    标题画面 V1.01 by SUPERNOVA Games
  5. #==============================================================================
  6. #
  7. # How to use:
  8. #   1.Add this script above Main.   
  9. #   2.Put your own logo picture in Graphics/System/.
  10. #   3.Put your own logo music in Audio/ME/.
  11. #   4.Change LOGO_PICTURE & LOGO_MUSIC's filename as
  12. #     your music and pictre's name.
  13. #   5. Set logo's fadein/fadeout speed  and the waiting time between fadein/fadeout as your wish.
  14. #   6..In game press Input B to skip logo.
  15. #
  16. # 如何使用:
  17. #   1.将此脚本插入Main脚本之前。   
  18. #   2.将Logo图片放入“Graphics/System/”文件夹。
  19. #   3.将Logo音乐放入“Audio/ME/”文件夹。
  20. #   4将LOGO_MUSIC和LOGO_PICTURE名称修改为Logo图片和Logo音乐文件名。
  21. #   5.将LOGO_SPEED数值设定为你要淡入淡出的速度,将LOGO_WAIT数值设定为淡入淡出间隔的帧数。
  22. #   6.在游戏中可按取消键跳过标题画面。
  23. #==============================================================================
  24. module SUPERNOVA
  25.   LOGO_MUSIC = "Logo"      #logo music
  26.   LOGO_PICTURE = "Logo"  #logo image
  27.   LOGO_SPEED = 50   #fadein/fadeout speed
  28.   LOGO_WAIT = 100   #waiting time between fadein/fadeout
  29. end
  30. #==============================================================================
  31. # ** SceneManager
  32. #==============================================================================
  33. module SceneManager
  34.   #--------------------------------------------------------------------------
  35.   # * Clear Call Stack
  36.   #--------------------------------------------------------------------------
  37.   def self.clear
  38.     $Logo = false
  39.     @stack.clear
  40.   end
  41. end
  42. #==============================================================================
  43. #  ** Scene_Title
  44. #==============================================================================
  45.  
  46. class Scene_Title < Scene_Base
  47.   #--------------------------------------------------------------------------
  48.   # * Start processing
  49.   #--------------------------------------------------------------------------
  50.   def start
  51.     super
  52.     if $Logo == true or $TEST
  53.     SceneManager.clear
  54.     Graphics.freeze
  55.     create_background
  56.     create_foreground
  57.     create_command_window
  58.     play_title_music
  59.   else
  60.     SceneManager.call(Scene_Logo)
  61.     end
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * Termination Processing
  65.   #--------------------------------------------------------------------------
  66.   def terminate
  67.     super
  68.     if $Logo == true or $TEST
  69.     SceneManager.snapshot_for_background
  70.     dispose_background
  71.     dispose_foreground
  72.     end
  73.   end
  74. end
  75. #==============================================================================
  76. # ** Scene_Logo
  77. #==============================================================================
  78. class Scene_Logo < Scene_Base
  79.   #--------------------------------------------------------------------------
  80.   # * Start processing
  81.   #--------------------------------------------------------------------------
  82.   def start
  83.     super
  84.     Audio.me_play("Audio/ME/" + SUPERNOVA::LOGO_MUSIC, 100, 100)
  85.     create_logo_graphic  
  86.     @logo_fadein = true
  87.     @logo_fadeout = false
  88.     @logo_quick_exit = false
  89.     @wait_count = 0
  90.     @logo_speed = SUPERNOVA::LOGO_SPEED
  91.     @logo_wait = SUPERNOVA::LOGO_WAIT
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # * Termination Processing
  95.   #--------------------------------------------------------------------------
  96.   def terminate
  97.     super
  98.     $Logo = true
  99.     dispose_logo_graphic
  100.    end
  101.   #--------------------------------------------------------------------------
  102.   # * Frame Update
  103.   #--------------------------------------------------------------------------
  104.   def update
  105.     super
  106.      @wait_count += 1
  107.      update_logo_wait
  108.     if @logo_fadein == true
  109.       update_logo_fadein      
  110.     end   
  111.     if @logo_fadeout == true
  112.       update_logo_fadeout   
  113.     end
  114.     if @logo_quick_exit == true
  115.       update_quick_exit
  116.     end
  117.     if Input.trigger?(Input::B)
  118.       @logo_quick_exit = true
  119.     end
  120.   end  
  121.   #--------------------------------------------------------------------------
  122.   # * Update Logo Fadein
  123.   #--------------------------------------------------------------------------
  124.   def update_logo_fadein
  125.     @logo.opacity += @logo_speed if @logo.opacity < 255
  126.   end   
  127.   #--------------------------------------------------------------------------
  128.   # * Update Logo Fadeout
  129.   #--------------------------------------------------------------------------
  130.   def update_logo_fadeout
  131.     @logo.opacity -= @logo_speed if @logo.opacity > 0  
  132.     if @logo.opacity == 0
  133.       Audio.me_stop
  134.       Audio.se_stop
  135.       SceneManager.call(Scene_Title)           
  136.       return      
  137.     end
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # * Update Quick Exit
  141.   #--------------------------------------------------------------------------
  142.   def update_quick_exit
  143.    if @logo_quick_exit == true
  144.     @logo.opacity -= 20 if @logo.opacity > 0   
  145.     if @logo.opacity == 0
  146.       Audio.me_stop
  147.       Audio.se_stop
  148.       SceneManager.call(Scene_Title)           
  149.       return      
  150.     end
  151.    end
  152. end
  153.   #--------------------------------------------------------------------------
  154.   # * Update Logo Wait
  155.   #--------------------------------------------------------------------------
  156.    def update_logo_wait
  157.      if  @logo_quick_exit == true
  158.      @logo_fadein = false
  159.      @logo_fadeout = false
  160.       else
  161.      @logo_fadein = true if @wait_count <= @logo_wait + 255/@logo_speed
  162.      @logo_fadeout = false  if @wait_count <= @logo_wait + 255/@logo_speed
  163.      @logo_fadein = false if @wait_count > @logo_wait + 255/@logo_speed
  164.      @logo_fadeout = true  if @wait_count > @logo_wait + 255/@logo_speed
  165.      end
  166.    end
  167.   #--------------------------------------------------------------------------
  168.   # * Create Logo Graphic
  169.   #--------------------------------------------------------------------------
  170.   def create_logo_graphic
  171.     @logo = Sprite.new
  172.     @logo.bitmap  = Cache.system(SUPERNOVA::LOGO_PICTURE)           
  173.     @logo.opacity = 0
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * Dispose Logo Graphic
  177.   #--------------------------------------------------------------------------
  178.   def dispose_logo_graphic
  179.     @logo.bitmap.dispose
  180.   end
  181. end




版本更新历史:
V1.0 2014-5-19
V1.01 2014-5-20
   ×更新内容:增加速度和等待时间自定义。
                       增加VA版本。

作者: Mr.Jin    时间: 2014-5-18 21:52
很NB的思路,赞一个.
其实,以前我都是用直接改Scene.Title来做Logo的0 0
作者: 我的米呀    时间: 2014-5-18 22:27
Mr.Jin 发表于 2014-5-18 21:52
很NB的思路,赞一个.
其实,以前我都是用直接改Scene.Title来做Logo的0 0


不用Scene_Title来改是想提高兼容性,因为现在用默认标题画面的似乎很少了{:2_276:}
作者: 皮卡星    时间: 2014-5-19 01:20
米君发东西了居然没叫我( ;ω;)
其实既然要发布的话推荐在module多加点东西比较好
比如说@wait_count的400可以在module里面放
还有@logo.opacity的速度
还有直接这样覆盖main不太推荐……其实可以直接在标题界面里面放的,一开始的时候用loop执行就行了
不过这样要直接重新写你这脚本了,嘛我这只是一种写法
因为我就是这样做的
作者: 菜鸟飞呀飞    时间: 2014-5-19 01:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: fux2    时间: 2014-5-19 15:48
我的米呀我的米呀我的米呀我的米呀我的米呀我的米呀我的米呀我的米呀好顶赞!
update_logo_wait里面的代码对齐逼死强迫症
作者: 我的米呀    时间: 2014-5-19 21:57
皮卡星 发表于 2014-5-19 01:20
米君发东西了居然没叫我( ;ω;)
其实既然要发布的话推荐在module多加点东西比较好
比如说@wait_count的40 ...

0 0说到自定义内容增加这点确实呢,其实有想过吧我坑里的原版动态效果也纳入,但想想作为泛用性的的脚本还是算了(||| -_-)另外loop执行这点……我一直没用过,结果爬回脚本编辑器搜索了下……然后发现我的写法果然太菜了啊啊啊OTL
作者: 眼中目之瞳    时间: 2014-5-20 21:32
请问有Ace版本的吗,Ace没找到Main脚本……
作者: kuerlulu    时间: 2014-5-21 05:46
•﹏•想当初在下直接包装成一个特别长的方法【好像不是很长
然后main前执行一下就行了【而且游戏中也可以[事件]_[脚本]调用
作者: taroxd    时间: 2014-5-21 07:55
本帖最后由 taroxd 于 2014-5-21 08:10 编辑

代码强迫症路过,有种楼主不适应Ruby的感觉呢~

RUBY 代码复制
  1. def update_logo_wait
  2.     waiting = @wait_count <= @logo_wait + 255 / @logo_speed
  3.     @logo_fadein  = !@logo_quick_exit && waiting
  4.     @logo_fadeout = !@logo_quick_exit && !waiting
  5.   end


作者: 你最珍贵    时间: 2014-5-22 21:39
{:8_444:}好长啊事实上显示LOGO不用这么麻烦吧




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