| 
 
| 赞 | 274 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 153 |  
| 经验 | 515 |  
| 最后登录 | 2025-10-8 |  
| 在线时间 | 2108 小时 |  
 Lv4.逐梦者 
	梦石1 星屑14293 在线时间2108 小时注册时间2017-9-28帖子663 | 
| 懒得手动设定,可以使用移动路线里的脚本: fade_opacity_to(0, 60) 
 
 复制代码#==============================================================================
# ** TDS 移动路线代码
#    Ver: 1.0
#------------------------------------------------------------------------------
#  * 介绍
#  本脚本可以使用各种方式简化"移动路线"
#------------------------------------------------------------------------------
#  * 功能: 
#  移动一段距离. (例如: 向上移动 x 10 次)
#  淡入淡出(不透明度逐渐变化)
#  显示心情气球.
#------------------------------------------------------------------------------
#  * 使用方法:
#  以下脚本都可以用在事件指令“移动路线”的“脚本”里 
#
#  朝某个方向移动一段距离:
#
#    move_times(方向,距离)
#    
#    方向:可以替换为  :UP  :DOWN  :LEFT  :RIGHT  (分别代表上、下、左、右)
#
#    距离:移动的距离(多少图块/步)
#
#    例子:
#    
#      move_times(:UP, 5)
#      move_times(4, 5)
#
#    以上两条都是一样的,因为上方向的移动代码是4 
#
#  不透明度逐渐变为某值:
#
#    fade_opacity_to(不透明度, 时间) 
#
#    不透明度 = 淡入/淡出到的不透明度
#    时间 = 淡入/淡出的总时间
#
#    例子:
#
#      fade_opacity_to(0, 60)   
#
#     效果是不透明度在60帧内渐变到0
#
#  显示心情气球:
#
#    show_balloon_icon(代码, wait = false) 
#
#    代码 = 心情气球的代码. 是心情求的索引,从第一行到最后一行是 1 到 10. 
#           你也可以使用气球的名字作为标志
# :Exclamation => 1, :Question => 2, :Music_Note => 3, :Heart => 4, :Anger => 5,
# :Sweat => 6, :Cobweb => 7, :Silence => 8, :Light_Bulb => 9, :Zzz => 10
#
#    wait = 等待直至心情气球显示结束 
#
#    例子:
#
#      show_balloon_icon(1) 
#      show_balloon_icon(:Exclamation)
#------------------------------------------------------------------------------
#  * Notes:
#  none.
#------------------------------------------------------------------------------
# 警告: (哦)
#
# Do not release, distribute or change my work without my expressed written 
# consent, doing so violates the terms of use of this work.
#
# If you really want to share my work please just post a link to the original
# site.
#
# * Not Knowing English or understanding these terms will not excuse you in any
#   way from the consequenses.
#------------------------------------------------------------------------------
# * Import to Global Hash
#==============================================================================
($imported ||= {})[:TDS_Movement_Code] = true
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  A character class with mainly movement route and other such processing
# added. It is used as a super class of Game_Player, Game_Follower,
# GameVehicle, and Game_Event.
#==============================================================================
class Game_Character < Game_CharacterBase
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  # Move Commands Symbol Code 
  MOVE_SYMBOL_CODE = {
  :UP    => ROUTE_MOVE_UP,
  :DOWN  => ROUTE_MOVE_DOWN,
  :LEFT  => ROUTE_MOVE_LEFT,
  :RIGHT => ROUTE_MOVE_RIGHT,
  :FORWARD => ROUTE_MOVE_FORWARD,
  :BACKWARD => ROUTE_MOVE_BACKWARD,
  }
  # Balloon Symbol ID
  BALLOON_SYMBOL_ID = {
  :Exclamation => 1, :Question => 2, :Music_Note => 3, :Heart => 4, :Anger => 5,
  :Sweat => 6, :Cobweb => 7, :Silence => 8, :Light_Bulb => 9, :Zzz => 10
  }
  #--------------------------------------------------------------------------
  # * Fade Opacity to Value
  #     opacity  : target opacity value
  #     duration : fade duration
  #--------------------------------------------------------------------------
  def fade_opacity_to(opacity, duration) 
    # Get Step Opacity
    step = (opacity - @opacity).to_f / duration
    # Get Change Opacity
    c_opacity = @opacity    
    duration.times {|i| 
    # Add Opacity Change Move Command
    @move_route.list.insert(@move_route_index + i + 1, RPG::MoveCommand.new(ROUTE_CHANGE_OPACITY, [c_opacity]))
    # Set Change Opacity
    c_opacity += step    
    }
  end
  #--------------------------------------------------------------------------
  # * Show Balloon Icon
  #     code : balloon id (Index or Symbol)
  #     wait : wait until balloon is done displaying flag
  #--------------------------------------------------------------------------
  def show_balloon_icon(code, wait = false) 
    # Convert Code From Symbol to Integer if applicable
    code = BALLOON_SYMBOL_ID[code] if code.is_a?(Symbol)    
    # Set Balloon ID
    @balloon_id = code
    # Set Wait Count if Wait flag is true
    @wait_count = 8 * 8 + 12 if wait
  end
  #--------------------------------------------------------------------------
  # * Move by Times
  #    code  : move code
  #    times : times to move using code
  #--------------------------------------------------------------------------
  def move_times(code, times)
    # Convert Code From Symbol to Integer if applicable
    code = MOVE_SYMBOL_CODE[code] if code.is_a?(Symbol)
    # Add Move Route Code
    times.times {|i| @move_route.list.insert(@move_route_index + i + 1, RPG::MoveCommand.new(code))}
  end
end
 | 
 评分
查看全部评分
 |