Project1

标题: 如何使技能动画施放时屏幕震动? [打印本页]

作者: domencasio    时间: 2011-1-12 15:43
标题: 如何使技能动画施放时屏幕震动?
RT
想要实现的效果是释放技能的时候屏幕能够震动,和事件中添加的效果一样就行。
但是不想用事件做,放在每次战斗中又要设置开光,又要每个敌人都复制太麻烦,有这方面的脚本支援么?
作者: terry_zhp    时间: 2011-1-12 16:05
特技可以调用公共事件,在公共事件内设置就可以了
作者: 企鹅达达    时间: 2011-1-12 19:29
技能需要设置技能动画,而动画里面右上角的框框可以设置震动、变色、声效……
作者: domencasio    时间: 2011-1-14 11:11
本帖最后由 domencasio 于 2011-1-14 11:12 编辑

回复 企鹅达达 的帖子
用了两年了我都不知道
怎么设置震动,只能设置颜色闪烁吧

作者: 诡异の猫    时间: 2011-1-14 11:22
回复 domencasio 的帖子

你是想每次技能攻击震动频率都一样吗?
这样会很怪吧- -
不然用脚本的话也还是要逐个技能逐个技能设置震动频率呃
也就是震动的强度、速度还有时间
作者: fux2    时间: 2011-1-14 12:07
本帖最后由 fux2 于 2011-1-14 12:34 编辑

回复 domencasio 的帖子

如果想滤掉特殊技能自行判断吧
  1. class Scene_Battle < Scene_Base
  2.   
  3.   alias:fux2:execute_action_skill
  4.   def execute_action_skill
  5.     $game_troop.screen.start_shake(5, 5, 10)
  6.     @spriteset.fux2.ox = $game_troop.screen.shake
  7.     fux2
  8.   end
  9.   
  10. end

  11. class Spriteset_Battle
  12.   
  13.   def fux2
  14.     return @viewport1
  15.   end
  16.   
  17. end
复制代码

作者: 九夜神尊    时间: 2011-1-14 12:08
本帖最后由 九夜神尊 于 2011-1-14 12:22 编辑

其实我这里有相应脚本,只不过不是我的原创。不能用来发布
用法:就跟设置动画一样!
  1. module RPG
  2.   class Sprite < ::Sprite
  3.     def animation_process_timing(timing, hit)
  4.       if (timing.condition == 0) or
  5.          (timing.condition == 1 and hit == true) or
  6.          (timing.condition == 2 and hit == false)
  7.         if timing.se.name != ""
  8.           se = timing.se
  9.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  10.         end
  11.         case timing.flash_scope
  12.         when 1
  13.           self.flash(timing.flash_color, timing.flash_duration * 2)
  14.         when 2
  15.           if timing.flash_color.alpha == 0
  16.             if (timing.flash_duration <= 3)
  17.               if $_orzFly_EnhancedShake
  18.                 $game_screen.start_shake(timing.flash_color.red, timing.flash_color.green, timing.flash_color.blue * 2, timing.flash_duration - 1) unless $game_screen.nil?
  19.               else
  20.                 $game_screen.start_shake(timing.flash_color.red, timing.flash_color.green, timing.flash_color.blue * 2) unless $game_screen.nil?
  21.               end
  22.             end
  23.           else
  24.             if self.viewport != nil
  25.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  26.             end
  27.           end
  28.         when 3
  29.           self.flash(nil, timing.flash_duration * 2)
  30.         end
  31.       end
  32.     end
  33.   end
  34. end
  35. class Spriteset_Battle
  36.   alias :_orzFly_EnhancedShake_update :update
  37.   def update
  38.     ox, oy = @viewport1.ox, @viewport1.oy
  39.     if ($game_screen.shake_duration <= 1)
  40.       ox, oy = 0, 0
  41.     else
  42.       if ($game_screen.shake_type == 0)
  43.         ox = $game_screen.shake
  44.       elsif ($game_screen.shake_type == 1)
  45.         oy = $game_screen.shake
  46.       elsif ($game_screen.shake_type == 2)
  47.         ox, oy = $game_screen.shake, $game_screen.shake
  48.       end
  49.       ox *= -1 if rand() < 0.5
  50.       oy *= -1 if rand() < 0.5
  51.       ox *= rand()
  52.       oy *= rand()
  53.     end
  54.     _orzFly_EnhancedShake_update
  55.     @viewport1.ox, @viewport1.oy = ox, oy
  56.     @viewport1.update
  57.   end
  58. end
  59. class Game_Screen
  60.   attr_reader :shake_type
  61.   attr_reader :shake_duration
  62.   alias :_orzFly_EnhancedShake_initialize :initialize
  63.   def initialize
  64.     _orzFly_EnhancedShake_initialize
  65.     @shake_type = 0
  66.   end
  67.   def start_shake(power, speed, duration, type = 0)
  68.     @shake_power = power
  69.     @shake_speed = speed
  70.     @shake_duration = duration
  71.     @shake_type = type
  72.   end
  73.   alias :_orzFly_EnhancedShake_update :update
  74.   def update
  75.     old_shake, old_shake_duration, old_shake_direction = @shake, @shake_duration, @shake_direction
  76.     _orzFly_EnhancedShake_update
  77.     @shake, @shake_duration, @shake_direction = old_shake, old_shake_duration, old_shake_direction   
  78.     if @shake_duration >= 1 or @shake != 0
  79.       delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
  80.       if @shake_duration <= 1 and @shake * (@shake + delta) < 0
  81.         @shake = 0
  82.       else
  83.         @shake += delta
  84.       end
  85.       if @shake > @shake_power * 2
  86.         @shake_direction = -1
  87.       end
  88.       if @shake < - @shake_power * 2
  89.         @shake_direction = 1
  90.       end
  91.       if @shake_duration >= 1
  92.         @shake_duration -= 1
  93.       end
  94.     end
  95.   end
  96. end
复制代码
使用方法:

未命名.jpg (55.03 KB, 下载次数: 13)

未命名.jpg

作者: domencasio    时间: 2011-1-14 12:20
回复 terry_zhp 的帖子

技能运行公共事件只能实现
技能施放完毕-》公共事件
无法实现
技能施放中-》公共事件
作者: 企鹅达达    时间: 2011-1-14 15:02
回复 domencasio 的帖子

……偶错了T.T 在下在自己受到攻击的时候画面都在震动,就以为动画里面设置了……貌似是里面的某个脚本起作用,呜




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