赞 | 13 |
VIP | 27 |
好人卡 | 24 |
积分 | 6 |
经验 | 58769 |
最后登录 | 2017-11-28 |
在线时间 | 795 小时 |
Lv2.观梦者 无节操
- 梦石
- 0
- 星屑
- 607
- 在线时间
- 795 小时
- 注册时间
- 2009-2-6
- 帖子
- 3939
|
本帖最后由 moy 于 2010-7-4 05:06 编辑
看效果的话,似乎是直接读取了角色的中心点和对象的中心点,然后就这么让动画移动过去的样子......脚本不太会,不知道具体应该怎么改.
本来倒是想看看的....结果自己找了找就几乎把整个脚本挪出来了=. =果然是实力不够看什么都要啊...
不过核心思想应该在这一段:
- #--------------------------------------------------------------------------
- # ● 遠距離アニメ目標座標の計算
- #--------------------------------------------------------------------------
- def flying_setup
- # 二度目は実行しない
- return if @flying_distance != nil && !camera_correctness
- if RTAB
- targets = @target
- else
- targets = $scene.target_battlers
- end
- # 目的座標を計算
- @f_target_x = 0
- @f_target_y = 0
- for t in targets
- @f_target_x += t.screen_x
- @f_target_y += t.screen_y
- end
- if targets != []
- @f_target_x /= targets.size
- @f_target_y /= targets.size
- else
- @flying_distance = 0
- return
- end
- # 距離の計算
- @flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
- end
- #--------------------------------------------------------------------------
- # ● 遠距離アニメ
- #--------------------------------------------------------------------------
- def flying_animation
- # 戻る
- if @step != "flying" or @flying_distance.nil?
- return [false,true]
- end
- # あらかじめ計算
- self_x = self.screen_x
- self_y = self.screen_y
- @flying_distance = @flying_distance == 0 ? 1 : @flying_distance
- n1 = @flying_wait / @flying_distance.to_f
- if @flying_distance - @flying_wait > @flying_distance / 2
- n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
- else
- n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
- end
- if !@flying_anime[4]
- # 直線移動
- x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
- y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
- else
- # 曲線移動
- if !@flying_proceed_end
- x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
- y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
- else
- x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
- y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
- end
- end
- # 座標代入
- @flying_x = x
- @flying_y = y
- # ウエイト
- if !@flying_proceed_end
- # 開始
- @flying_proceed_start = @flying_wait == 0
- @flying_wait += @flying_anime[1]
- @flying_wait = [@flying_wait,@flying_distance].min
- @flying_proceed_end = @flying_wait == @flying_distance
- else
- # 開始
- @flying_return_start = @flying_wait == @flying_distance
- @flying_wait -= @flying_anime[1]
- @flying_wait = [@flying_wait,0].max
- @flying_return_end = @flying_wait == 0
- end
- if @flying_anime[1] == 0
- @flying_end = true
- elsif !@flying_anime[2]
- @flying_end = @flying_proceed_end
- else
- @flying_end = @flying_return_end
- end
- # 値を返す(アニメ開始,アニメ終了)
- return [@flying_proceed_start,@flying_end]
- end
- #--------------------------------------------------------------------------
- # ● 遠距離アニメ初期化
- #--------------------------------------------------------------------------
- def flying_clear
- @flying_proceed_start = false
- @flying_proceed_end = false
- @flying_return_start = false
- @flying_return_end = false
- @flying_end = false
- @flying_anime = [0,0,false]
- end
复制代码 |
评分
-
查看全部评分
|