设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2885|回复: 2
打印 上一主题 下一主题

[已经过期] 关于战斗震动的脚本。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
帖子
799
跳转到指定楼层
1
发表于 2012-8-21 18:34:24 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
因为我在用后知后觉的横版,想希望在动画的使用技能的时候加入画面震动,我找到一个VX版本,无法直接使用,哪个能帮忙改改?要能后知后觉的横版脚本兼容,否则就没有意义了。
  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
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
帖子
799
2
 楼主| 发表于 2012-8-21 18:36:28 | 只看该作者


直接使用是这样。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
帖子
799
3
 楼主| 发表于 2012-8-22 19:12:46 | 只看该作者
谁来解释一下这个错误是什么意思也好

shake_duration明明在game_screen发现有。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 20:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表