Project1
标题: 关于战斗震动的脚本。 [打印本页]
作者: lirn 时间: 2012-8-21 18:34
标题: 关于战斗震动的脚本。
因为我在用后知后觉的横版,想希望在动画的使用技能的时候加入画面震动,我找到一个VX版本,无法直接使用,哪个能帮忙改改?要能后知后觉的横版脚本兼容,否则就没有意义了。- module RPG
- class Sprite < ::Sprite
- def animation_process_timing(timing, hit)
- if (timing.condition == 0) or
- (timing.condition == 1 and hit == true) or
- (timing.condition == 2 and hit == false)
- if timing.se.name != ""
- se = timing.se
- Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
- end
- case timing.flash_scope
- when 1
- self.flash(timing.flash_color, timing.flash_duration * 2)
- when 2
- if timing.flash_color.alpha == 0
- if (timing.flash_duration <= 3)
- if $_orzFly_EnhancedShake
- $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?
- else
- $game_screen.start_shake(timing.flash_color.red, timing.flash_color.green, timing.flash_color.blue * 2) unless $game_screen.nil?
- end
- end
- else
- if self.viewport != nil
- self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
- end
- end
- when 3
- self.flash(nil, timing.flash_duration * 2)
- end
- end
- end
- end
- end
- class Spriteset_Battle
- alias :_orzFly_EnhancedShake_update :update
- def update
- ox, oy = @viewport1.ox, @viewport1.oy
- if ($game_screen.shake_duration <= 1)
- ox, oy = 0, 0
- else
- if ($game_screen.shake_type == 0)
- ox = $game_screen.shake
- elsif ($game_screen.shake_type == 1)
- oy = $game_screen.shake
- elsif ($game_screen.shake_type == 2)
- ox, oy = $game_screen.shake, $game_screen.shake
- end
- ox *= -1 if rand() < 0.5
- oy *= -1 if rand() < 0.5
- ox *= rand()
- oy *= rand()
- end
- _orzFly_EnhancedShake_update
- @viewport1.ox, @viewport1.oy = ox, oy
- @viewport1.update
- end
- end
- class Game_Screen
- attr_reader :shake_type
- attr_reader :shake_duration
- alias :_orzFly_EnhancedShake_initialize :initialize
- def initialize
- _orzFly_EnhancedShake_initialize
- @shake_type = 0
- end
- def start_shake(power, speed, duration, type = 0)
- @shake_power = power
- @shake_speed = speed
- @shake_duration = duration
- @shake_type = type
- end
- alias :_orzFly_EnhancedShake_update :update
- def update
- old_shake, old_shake_duration, old_shake_direction = @shake, @shake_duration, @shake_direction
- _orzFly_EnhancedShake_update
- @shake, @shake_duration, @shake_direction = old_shake, old_shake_duration, old_shake_direction
- if @shake_duration >= 1 or @shake != 0
- delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
- if @shake_duration <= 1 and @shake * (@shake + delta) < 0
- @shake = 0
- else
- @shake += delta
- end
- if @shake > @shake_power * 2
- @shake_direction = -1
- end
- if @shake < - @shake_power * 2
- @shake_direction = 1
- end
- if @shake_duration >= 1
- @shake_duration -= 1
- end
- end
- end
- end
复制代码