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按本】

将如下脚本:
[pre lang="ruby" line="1"] if $TEST
  $scene = Scene_Title.new  
else
  $scene = Scene_Logo.new
  end[/pre]
修改为:
[pre lang="ruby" line="1"]$scene = Scene_Logo.new
[/pre]
即可。

【VA]版本】

搜索以下语句:
[pre lang="ruby" line="1"]if $Logo == true or $TEST[/pre]
改为
[pre lang="ruby" line="1"]if $Logo == true[/pre]

请注意,共有两处。



VX版本

[pre lang="ruby" line="1"]#==============================================================================
# ** Logo  V1.01 by SUPERNOVA Games
#
#    标题画面 by SUPERNOVA Games
#==============================================================================
#
# How to use:
#   1.Add this script above Main.   
#   2.Put your own logo picture in Graphics/System/.
#   3.Put your own logo music in Audio/ME/.
#   4.Change LOGO_PICTURE & LOGO_MUSIC's filename as
#     your music and pictre's name.
#   5. Set logo's fadein/fadeout speed  and the waiting time between fadein/fadeout as your wish.
#   6.In game press Input B to skip logo.
#
# 如何使用:
#   1.将此脚本插入Main脚本之前。   
#   2.将Logo图片放入“Graphics/System/”文件夹。
#   3.将Logo音乐放入“Audio/ME/”文件夹。
#   4将LOGO_MUSIC和LOGO_PICTURE名称修改为Logo图片和Logo音乐文件名。
#   5.将LOGO_SPEED数值设定为你要淡入淡出的速度,将LOGO_WAIT数值设定为淡入淡出间隔的帧数。
#   6.在游戏中可按取消键跳过标题画面。
#==============================================================================
module SUPERNOVA
  LOGO_MUSIC = "Logo"      #logo music
  LOGO_PICTURE = "Logo"  #logo image
  LOGO_SPEED = 50   #fadein/fadeout speed
  LOGO_WAIT = 100   #waiting time between fadein/fadeout
end
#==============================================================================
# ** Scene_Logo
#==============================================================================
class Scene_Logo < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    Audio.me_play("Audio/ME/" + SUPERNOVA::LOGO_MUSIC, 100, 100)
    create_logo_graphic  
    @logo_fadein = true
    @logo_fadeout = false
    @logo_quick_exit = false
    @wait_count = 0
    @logo_speed = SUPERNOVA::LOGO_SPEED
    @logo_wait = SUPERNOVA::LOGO_WAIT
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    $Logo = true
    dispose_logo_graphic
   end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
     @wait_count += 1
     update_logo_wait
    if @logo_fadein == true
      update_logo_fadein      
    end   
    if @logo_fadeout == true
      update_logo_fadeout   
    end
    if @logo_quick_exit == true
      update_quick_exit
    end
    if Input.trigger?(Input::B)
      @logo_quick_exit = true
    end
  end  
  #--------------------------------------------------------------------------
  # * Update Logo Fadein
  #--------------------------------------------------------------------------
  def update_logo_fadein
    @logo.opacity += @logo_speed if @logo.opacity < 255
  end   
  #--------------------------------------------------------------------------
  # * Update Logo Fadeout
  #--------------------------------------------------------------------------
  def update_logo_fadeout
    @logo.opacity -= @logo_speed if @logo.opacity > 0  
    if @logo.opacity == 0
      Audio.me_stop
      Audio.se_stop
      $scene = Scene_Title.new           
      return      
    end
  end
  #--------------------------------------------------------------------------
  # * Update Quick Exit
  #--------------------------------------------------------------------------
  def update_quick_exit
   if @logo_quick_exit == true
    @logo.opacity -= 20 if @logo.opacity > 0   
    if @logo.opacity == 0
      Audio.me_stop
      Audio.se_stop
      $scene = Scene_Title.new           
      return      
    end
   end
end
  #--------------------------------------------------------------------------
  # * Update Logo Wait
  #--------------------------------------------------------------------------
   def update_logo_wait
     if  @logo_quick_exit == true
     @logo_fadein = false
     @logo_fadeout = false
      else
     @logo_fadein = true if @wait_count <= @logo_wait + 255/@logo_speed
     @logo_fadeout = false  if @wait_count <= @logo_wait + 255/@logo_speed
     @logo_fadein = false if @wait_count > @logo_wait + 255/@logo_speed
     @logo_fadeout = true  if @wait_count > @logo_wait + 255/@logo_speed
     end
   end
  #--------------------------------------------------------------------------
  # * Create Logo Graphic
  #--------------------------------------------------------------------------
  def create_logo_graphic
    @logo = Sprite.new
    @logo.bitmap  = Cache.system(SUPERNOVA::LOGO_PICTURE)           
    @logo.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Dispose Logo Graphic
  #--------------------------------------------------------------------------
  def dispose_logo_graphic
    @logo.bitmap.dispose
  end
end
#==============================================================================
# ** Main
#------------------------------------------------------------------------------
#  After defining each class, actual processing begins here.
#==============================================================================
Font.default_name = ["SimHei", "黑体", "DFKai-SB", "標楷體", "Verdana", "Arial Unicode MS"]
begin
  Graphics.freeze
  if $TEST
  $scene = Scene_Title.new  
else
  $scene = Scene_Logo.new
  end
  $scene.main while $scene != nil
  Graphics.transition(30)
rescue Errno::ENOENT
  filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
end[/pre]



VA版本
[pre lang="ruby" line="1"]#==============================================================================
# ** Logo V1.01 by SUPERNOVA Games   
#
#    标题画面 V1.01 by SUPERNOVA Games
#==============================================================================
#
# How to use:
#   1.Add this script above Main.   
#   2.Put your own logo picture in Graphics/System/.
#   3.Put your own logo music in Audio/ME/.
#   4.Change LOGO_PICTURE & LOGO_MUSIC's filename as
#     your music and pictre's name.
#   5. Set logo's fadein/fadeout speed  and the waiting time between fadein/fadeout as your wish.
#   6..In game press Input B to skip logo.
#
# 如何使用:
#   1.将此脚本插入Main脚本之前。   
#   2.将Logo图片放入“Graphics/System/”文件夹。
#   3.将Logo音乐放入“Audio/ME/”文件夹。
#   4将LOGO_MUSIC和LOGO_PICTURE名称修改为Logo图片和Logo音乐文件名。
#   5.将LOGO_SPEED数值设定为你要淡入淡出的速度,将LOGO_WAIT数值设定为淡入淡出间隔的帧数。
#   6.在游戏中可按取消键跳过标题画面。
#==============================================================================
module SUPERNOVA
  LOGO_MUSIC = "Logo"      #logo music
  LOGO_PICTURE = "Logo"  #logo image
  LOGO_SPEED = 50   #fadein/fadeout speed
  LOGO_WAIT = 100   #waiting time between fadein/fadeout
end
#==============================================================================
# ** SceneManager
#==============================================================================
module SceneManager
  #--------------------------------------------------------------------------
  # * Clear Call Stack
  #--------------------------------------------------------------------------
  def self.clear
    $Logo = false
    @stack.clear
  end
end
#==============================================================================
#  ** Scene_Title
#==============================================================================

class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    if $Logo == true or $TEST
    SceneManager.clear
    Graphics.freeze
    create_background
    create_foreground
    create_command_window
    play_title_music
  else
    SceneManager.call(Scene_Logo)
    end
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    if $Logo == true or $TEST
    SceneManager.snapshot_for_background
    dispose_background
    dispose_foreground
    end
  end
end
#==============================================================================
# ** Scene_Logo
#==============================================================================
class Scene_Logo < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    Audio.me_play("Audio/ME/" + SUPERNOVA::LOGO_MUSIC, 100, 100)
    create_logo_graphic  
    @logo_fadein = true
    @logo_fadeout = false
    @logo_quick_exit = false
    @wait_count = 0
    @logo_speed = SUPERNOVA::LOGO_SPEED
    @logo_wait = SUPERNOVA::LOGO_WAIT
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    $Logo = true
    dispose_logo_graphic
   end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
     @wait_count += 1
     update_logo_wait
    if @logo_fadein == true
      update_logo_fadein      
    end   
    if @logo_fadeout == true
      update_logo_fadeout   
    end
    if @logo_quick_exit == true
      update_quick_exit
    end
    if Input.trigger?(Input::B)
      @logo_quick_exit = true
    end
  end  
  #--------------------------------------------------------------------------
  # * Update Logo Fadein
  #--------------------------------------------------------------------------
  def update_logo_fadein
    @logo.opacity += @logo_speed if @logo.opacity < 255
  end   
  #--------------------------------------------------------------------------
  # * Update Logo Fadeout
  #--------------------------------------------------------------------------
  def update_logo_fadeout
    @logo.opacity -= @logo_speed if @logo.opacity > 0  
    if @logo.opacity == 0
      Audio.me_stop
      Audio.se_stop
      SceneManager.call(Scene_Title)           
      return      
    end
  end
  #--------------------------------------------------------------------------
  # * Update Quick Exit
  #--------------------------------------------------------------------------
  def update_quick_exit
   if @logo_quick_exit == true
    @logo.opacity -= 20 if @logo.opacity > 0   
    if @logo.opacity == 0
      Audio.me_stop
      Audio.se_stop
      SceneManager.call(Scene_Title)           
      return      
    end
   end
end
  #--------------------------------------------------------------------------
  # * Update Logo Wait
  #--------------------------------------------------------------------------
   def update_logo_wait
     if  @logo_quick_exit == true
     @logo_fadein = false
     @logo_fadeout = false
      else
     @logo_fadein = true if @wait_count <= @logo_wait + 255/@logo_speed
     @logo_fadeout = false  if @wait_count <= @logo_wait + 255/@logo_speed
     @logo_fadein = false if @wait_count > @logo_wait + 255/@logo_speed
     @logo_fadeout = true  if @wait_count > @logo_wait + 255/@logo_speed
     end
   end
  #--------------------------------------------------------------------------
  # * Create Logo Graphic
  #--------------------------------------------------------------------------
  def create_logo_graphic
    @logo = Sprite.new
    @logo.bitmap  = Cache.system(SUPERNOVA::LOGO_PICTURE)           
    @logo.opacity = 0
  end
  #--------------------------------------------------------------------------
  # * Dispose Logo Graphic
  #--------------------------------------------------------------------------
  def dispose_logo_graphic
    @logo.bitmap.dispose
  end
end
[/pre]



版本更新历史:
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的感觉呢~

[pre lang="ruby" line="1"]  def update_logo_wait
    waiting = @wait_count <= @logo_wait + 255 / @logo_speed
    @logo_fadein  = !@logo_quick_exit && waiting
    @logo_fadeout = !@logo_quick_exit && !waiting
  end[/pre]

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




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